本文整理匯總了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;
}