本文整理汇总了Java中android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java Configuration.SCREENLAYOUT_SIZE_MASK属性的具体用法?Java Configuration.SCREENLAYOUT_SIZE_MASK怎么用?Java Configuration.SCREENLAYOUT_SIZE_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.res.Configuration
的用法示例。
在下文中一共展示了Configuration.SCREENLAYOUT_SIZE_MASK属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScreenType
private ScreenType getScreenType(Context context) {
int type = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
ScreenType result;
switch (type) {
case Configuration.SCREENLAYOUT_SIZE_SMALL:
result = ScreenType.SMALL;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
result = ScreenType.NORMAL;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
result = ScreenType.LARGE;
break;
default:
result = ScreenType.NORMAL;
break;
}
return result;
}
示例2: checkScreenSize
public void checkScreenSize() {
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch (screenSize) {
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
column_no = 4;
break;
case Configuration.SCREENLAYOUT_SIZE_UNDEFINED:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
column_no = 2;
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
column_no = 2;
break;
default:
column_no = 2;
}
}
示例3: checkScreenSize
public void checkScreenSize() {
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch (screenSize) {
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
column_no = 4;
break;
case Configuration.SCREENLAYOUT_SIZE_UNDEFINED:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
column_no = 2;
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
column_no = 2;
break;
default:
column_no = 2;
}
}
示例4: isTabletDevice
public boolean isTabletDevice(Context activityContext) {
boolean device_large = ((activityContext.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_LARGE);
if (device_large) {
DisplayMetrics metrics = new DisplayMetrics();
Activity activity = (Activity) activityContext;
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
if (metrics.densityDpi == DisplayMetrics.DENSITY_DEFAULT
|| metrics.densityDpi == DisplayMetrics.DENSITY_HIGH
|| metrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM
|| metrics.densityDpi == DisplayMetrics.DENSITY_TV
|| metrics.densityDpi == DisplayMetrics.DENSITY_XHIGH) {
return true;
}
}
return false;
}
示例5: calcInputKeyBtnHeight
@Override
public int calcInputKeyBtnHeight() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenOrientation = getResources().getConfiguration().orientation;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int nScreenShortSideInPx = Math.min(metrics.heightPixels, metrics.widthPixels);
int nScreenLongSideInPx = Math.max(metrics.heightPixels, metrics.widthPixels);
int nBtnHeight;
if (nScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
nBtnHeight = nScreenShortSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 6;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 8;
} else {
// large and xlarge
nBtnHeight /= 12; // because the ads are on top
}
} else {
nBtnHeight = nScreenLongSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 9;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 12;
} else {
// large and xlarge
nBtnHeight /= 18;
}
}
return nBtnHeight;
}
示例6: isTabletDevice
public static boolean isTabletDevice() {
try{
return (WXEnvironment.getApplication().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}catch (Exception e){
WXLogUtils.e("[WXUtils] isTabletDevice:", e);
}
return false;
}
示例7: isXLargeTablet
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
示例8: isXLargeTablet
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
protected static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
示例9: isTablet
public static boolean isTablet(Context c) {
boolean xlarge = ((c.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
boolean large = ((c.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
return (xlarge || large);
}
示例10: isTablet
/**
* 平板电脑?
*
* @return ??
*/
public static boolean isTablet(Context context) {
int s = context.getResources().getConfiguration().screenLayout;
s &= Configuration.SCREENLAYOUT_SIZE_MASK;
return s >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
示例11: isXLargeTablet
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}