且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

开发一个通用的Andr​​oid应用程序(手机和平板)

更新时间:2023-11-16 12:49:28

您可以查看谷歌I / O应用程序对于Android SRC code:

You can check the Google I/O App for Android src code:

在UIUtils类,你有以下几种方法:

In the UIUtils class you have the following methods:

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);
}