如何检查 Android 手机是横屏还是竖屏?
最佳答案
用于确定要检索哪些资源的当前配置可从资源的 Configuration
对象获得:
getResources().getConfiguration().orientation;
您可以通过查看其值来检查方向:
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
// In landscape
} else {
// In portrait
}
更多信息请见 Android Developer .
关于java - 在 Android 手机上检查方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2795833/