用于确定要检索哪些资源的当前配置可从Resources Configuration
对象中获得:
getResources().getConfiguration().orientation;
可以通过查看其值来判断方向:
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
// In landscape
} else {
// In portrait
}
更多信息可在Android Developer页中找到.