Android中 判断是平板还是手机

来源:互联网 发布:unity vr源码 编辑:程序博客网 时间:2024/04/27 13:26

//是平板返回true 不是平板返回false

public  boolean isTablet(Context context) {

  return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;

 }