【转】Android编程判断手机or平板
转载自:http://www.cnblogs.com/sunzn/p/3663363.html
1 /** 2 * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android 3 * @param context 4 * @return 平板返回 True,手机返回 False 5 */ 6 public static boolean isTablet(Context context) { 7 return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; 8 }
————————————————————————————————————————————————
来自企鹅娘的问候:
欢迎交流哦,如果有帮助转载的话,请务必注明出处"企鹅娘's 学习笔记",让我也小小的开心一下