检查取向对Android手机取向、手机、Android

2023-09-11 23:55:23 作者:Cold mood(冷情绪)

我如何检查Android手机在横向或纵向?

How can I check if the Android phone is in Landscape or Portrait?

推荐答案

目前的配置,用来确定检索哪些资源等,如可从资源配置对象为:

The current configuration, as used to determine which resources to retrieve etc, as available from the Resources' Configuration object as:

getResources().getConfiguration().orientation

http://developer.android.com/reference/android/content/res/Configuration.html#orientation

 
精彩推荐
图片推荐