android判断系统版本与屏幕尺寸

核心方法如下:

/**
     * 是否是3.0以上的系统
     * @return
     */
    public static boolean isHoneycomb() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
    }
 
    /**
     * 得到是否为平板电脑屏幕尺寸
     * @param context
     * @return
     */
    public static boolean isTablet(Context context) {
        int mask = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
        return (mask >= Configuration.SCREENLAYOUT_SIZE_LARGE);
    }

 

 

posted @ 2012-07-03 10:26  xianyuan  阅读(392)  评论(0编辑  收藏  举报