Android判断设备是手机还是平板

/**
 * 判断是否平板设备
 * @param context
 * @return true:平板,false:手机
 */
private boolean isTabletDevice(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
            Configuration.SCREENLAYOUT_SIZE_LARGE;
}

猜你喜欢

转载自blog.csdn.net/weixin_41012767/article/details/112918232
今日推荐