我试图弄清楚如何检查顶部活动(当前用户使用)的方向是否固定。假设用户正在使用Instagram,正如您所知,Instagram的方向始终是纵向的。有没有办法让我检查方向是否不可变/固定?谢谢!
以编程方式检查它。既然固定也意味着肖像
getResources().getConfiguration().orientation;
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
// Todo portrait
} else {
// Todo landscape
}