2011-11-01 63 views

回答

3

這裏是代碼:

public static boolean isHoneycomb() { 
      // Can use static final constants like HONEYCOMB, declared in later versions 
      // of the OS since they are inlined at compile time. This is guaranteed behavior. 
      return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; 
     } 

public static boolean isTablet(Context context) { 
    return (context.getResources().getConfiguration().screenLayout 
      & Configuration.SCREENLAYOUT_SIZE_MASK) 
      >= Configuration.SCREENLAYOUT_SIZE_LARGE; 
} 

public static boolean isHoneycombTablet(Context context) { 
    return isHoneycomb() && isTablet(context); 
} 

,或者你可以在AndroidManifest.xml設置suppurted屏幕:

<manifest ... > 
    <supports-screens android:xlargeScreens="true" /> 
    ... 
    </manifest> 

訪問的谷歌IO 2011官方源代碼here如果你想更多細節。

我希望它有幫助!

0

還有android.os.Build類。在製造商和型號等方面有許多靜態常量。

相關問題