代码改变世界

[Android Tips] 13. How to Detect Tablet

2014-09-04 16:02  shaobin0604  阅读(173)  评论(0编辑  收藏  举报
/**
  * 判断是否是平板
  * @param context
  * @return
  */
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

Ref