當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.SCREENLAYOUT_SIZE_MASK屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:MediaItemLayout.java

示例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;
        }
    }
 
開發者ID:MuditSrivastava,項目名稱:Canvas-Vision,代碼行數:26,代碼來源:DiscoverFragment.java

示例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;
        }
    }
 
開發者ID:MuditSrivastava,項目名稱:Canvas-Vision,代碼行數:24,代碼來源:ExploreFragment.java

示例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;
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:20,代碼來源:Comman.java

示例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;
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:33,代碼來源:ScriptEditorActivity.java

示例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;
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:8,代碼來源:WXUtils.java

示例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;
}
 
開發者ID:dandanes7,項目名稱:lurkerhn,代碼行數:8,代碼來源:SettingsActivity.java

示例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;
}
 
開發者ID:brolam,項目名稱:OpenHomeAnalysis,代碼行數:8,代碼來源:AppCompatPreferenceHelper.java

示例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);
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:5,代碼來源:AndroidUtils.java

示例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;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:10,代碼來源:TDevice.java

示例11: isXLargeTablet

private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
開發者ID:d0pam1n,項目名稱:DoorPhone,代碼行數:4,代碼來源:SettingsActivity.java


注:本文中的android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。