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


Java DisplayMetrics.DENSITY_XXXHIGH屬性代碼示例

本文整理匯總了Java中android.util.DisplayMetrics.DENSITY_XXXHIGH屬性的典型用法代碼示例。如果您正苦於以下問題:Java DisplayMetrics.DENSITY_XXXHIGH屬性的具體用法?Java DisplayMetrics.DENSITY_XXXHIGH怎麽用?Java DisplayMetrics.DENSITY_XXXHIGH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.util.DisplayMetrics的用法示例。


在下文中一共展示了DisplayMetrics.DENSITY_XXXHIGH屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLauncherIconDensity

private int getLauncherIconDensity(int requiredSize) {
    // Densities typically defined by an app.
    int[] densityBuckets = new int[] {
            DisplayMetrics.DENSITY_LOW,
            DisplayMetrics.DENSITY_MEDIUM,
            DisplayMetrics.DENSITY_TV,
            DisplayMetrics.DENSITY_HIGH,
            DisplayMetrics.DENSITY_XHIGH,
            DisplayMetrics.DENSITY_XXHIGH,
            DisplayMetrics.DENSITY_XXXHIGH
    };

    int density = DisplayMetrics.DENSITY_XXXHIGH;
    for (int i = densityBuckets.length - 1; i >= 0; i--) {
        float expectedSize = ICON_SIZE_DEFINED_IN_APP_DP * densityBuckets[i]
                / DisplayMetrics.DENSITY_DEFAULT;
        if (expectedSize >= requiredSize) {
            density = densityBuckets[i];
        }
    }

    return density;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:23,代碼來源:InvariantDeviceProfile.java

示例2: getAvatarUrl

public String getAvatarUrl(Context context) {
    if (context != null) {
        final int densityDpi = context.getResources().getDisplayMetrics().densityDpi;

        if ((densityDpi > DisplayMetrics.DENSITY_XXXHIGH ||
                densityDpi > DisplayMetrics.DENSITY_XXHIGH ||
                densityDpi > DisplayMetrics.DENSITY_XHIGH) && xhdpi_link != null) {
            return xhdpi_link;
        } else if (densityDpi > DisplayMetrics.DENSITY_HIGH && hdpi_link != null) {
            return hdpi_link;
        } else if (densityDpi > DisplayMetrics.DENSITY_MEDIUM && mdpi_link != null) {
            return mdpi_link;
        } else {
            return ldpi_link;
        }
    }
    return null;
}
 
開發者ID:Dentacoin,項目名稱:aftercare-app-android,代碼行數:18,代碼來源:DCAvatar.java

示例3: getDensityPostfix

public static String getDensityPostfix(Resources res) {
    String result = null;
    switch (res.getDisplayMetrics().densityDpi) {
        case DisplayMetrics.DENSITY_LOW:
            result = "ldpi";
            break;
        case DisplayMetrics.DENSITY_MEDIUM:
            result = "mdpi";
            break;
        case DisplayMetrics.DENSITY_HIGH:
            result = "hdpi";
            break;
        case DisplayMetrics.DENSITY_XHIGH:
            result = "xhdpi";
            break;
        case DisplayMetrics.DENSITY_XXHIGH:
            result = "xxhdpi";
            break;
        case DisplayMetrics.DENSITY_XXXHIGH:
            result = "xxxhdpi";
            break;
    }
    return result;
}
 
開發者ID:Blankeer,項目名稱:MDWechat,代碼行數:24,代碼來源:NinePatchBitmapFactory.java

示例4: getDensityString

private static String getDensityString(DisplayMetrics displayMetrics) {
  switch (displayMetrics.densityDpi) {
    case DisplayMetrics.DENSITY_LOW:
      return "ldpi";
    case DisplayMetrics.DENSITY_MEDIUM:
      return "mdpi";
    case DisplayMetrics.DENSITY_HIGH:
      return "hdpi";
    case DisplayMetrics.DENSITY_XHIGH:
      return "xhdpi";
    case DisplayMetrics.DENSITY_XXHIGH:
      return "xxhdpi";
    case DisplayMetrics.DENSITY_XXXHIGH:
      return "xxxhdpi";
    case DisplayMetrics.DENSITY_TV:
      return "tvdpi";
    default:
      return String.valueOf(displayMetrics.densityDpi);
  }
}
 
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:20,代碼來源:DebugView.java

示例5: getDensity

public static String getDensity(Context ctx) {
    String densityStr = null;
    final int density = ctx.getResources().getDisplayMetrics().densityDpi;
    switch (density) {
        case DisplayMetrics.DENSITY_LOW:
            densityStr = "LDPI";
            break;
        case DisplayMetrics.DENSITY_MEDIUM:
            densityStr = "MDPI";
            break;
        case DisplayMetrics.DENSITY_TV:
            densityStr = "TVDPI";
            break;
        case DisplayMetrics.DENSITY_HIGH:
            densityStr = "HDPI";
            break;
        case DisplayMetrics.DENSITY_XHIGH:
            densityStr = "XHDPI";
            break;
        case DisplayMetrics.DENSITY_400:
            densityStr = "XMHDPI";
            break;
        case DisplayMetrics.DENSITY_XXHIGH:
            densityStr = "XXHDPI";
            break;
        case DisplayMetrics.DENSITY_XXXHIGH:
            densityStr = "XXXHDPI";
            break;
    }
    return densityStr;
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:31,代碼來源:DeviceUtils.java

示例6: getDensity

/**
 * Maps the current display density to a string constant.
 * @param context context to use to retrieve the current display metrics
 * @return a string constant representing the current display density, or the
 *         empty string if the density is unknown
 */
static String getDensity(final Context context) {
    String densityStr = "";
    final int density = context.getResources().getDisplayMetrics().densityDpi;
    switch (density) {
        case DisplayMetrics.DENSITY_LOW:
            densityStr = "LDPI";
            break;
        case DisplayMetrics.DENSITY_MEDIUM:
            densityStr = "MDPI";
            break;
        case DisplayMetrics.DENSITY_TV:
            densityStr = "TVDPI";
            break;
        case DisplayMetrics.DENSITY_HIGH:
            densityStr = "HDPI";
            break;
        //todo uncomment in android sdk 25
        //case DisplayMetrics.DENSITY_260:
        //    densityStr = "XHDPI";
        //    break;
        case DisplayMetrics.DENSITY_280:
            densityStr = "XHDPI";
            break;
        //todo uncomment in android sdk 25
        //case DisplayMetrics.DENSITY_300:
        //    densityStr = "XHDPI";
        //    break;
        case DisplayMetrics.DENSITY_XHIGH:
            densityStr = "XHDPI";
            break;
        //todo uncomment in android sdk 25
        //case DisplayMetrics.DENSITY_340:
        //    densityStr = "XXHDPI";
        //    break;
        case DisplayMetrics.DENSITY_360:
            densityStr = "XXHDPI";
            break;
        case DisplayMetrics.DENSITY_400:
            densityStr = "XXHDPI";
            break;
        case DisplayMetrics.DENSITY_420:
            densityStr = "XXHDPI";
            break;
        case DisplayMetrics.DENSITY_XXHIGH:
            densityStr = "XXHDPI";
            break;
        case DisplayMetrics.DENSITY_560:
            densityStr = "XXXHDPI";
            break;
        case DisplayMetrics.DENSITY_XXXHIGH:
            densityStr = "XXXHDPI";
            break;
        default:
            densityStr = "other";
            break;
    }
    return densityStr;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:64,代碼來源:DeviceInfo.java

示例7: isXXXhdpiDensity

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static Boolean isXXXhdpiDensity() {
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    return metrics.densityDpi == DisplayMetrics.DENSITY_XXXHIGH;
}
 
開發者ID:yongbeam,項目名稱:AirQuickUtils,代碼行數:6,代碼來源:AirScreen.java


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