天天看点

Android 编程下判断当前设备是手机还是平板

/**
     * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
     * @param context
     * @return 平板返回 True,手机返回 False
     */
    public static boolean isTablet(Context context) {
        return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
    }      

专注移动互联网产品设计研发 分享最新的移动互联网产品和技术