如何确定Android中无传感器设置的屏幕方向?

问题描述 投票:0回答:1

如何为Android中的“ nosensor”屏幕方向模式确定屏幕方向?什么时候是纵向还是横向?

android
1个回答
0
投票

尝试一下

int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    // In landscape
} else {
    // In portrait
}
© www.soinside.com 2019 - 2024. All rights reserved.