跳至主要內容
autojs横竖屏监听
"ui";

let currentOrientation = context.resources.configuration.orientation

ui.layout(
    <vertical gravity="center">
        <text text="{{currentOrientation}}" />
    </vertical>
)

function onConfigurationChanged(newConfig) {
    if (newConfig.orientation != currentOrientation) {
        if (newConfig.orientation == 2) {
            log("横屏")
        } else {
            log("竖屏")
        }
    }
    currentOrientation = newConfig.orientation
}

context.registerComponentCallbacks({
    onConfigurationChanged: onConfigurationChanged
})

荒芜...小于 1 分钟前端autojs