List of usage examples for android.content.res Resources getSystem
public static Resources getSystem()
From source file:Main.java
public static int transDip(int dip) { float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (dip * scale + 0.5f); }
From source file:Main.java
public static int getNavigationBarHeight() { return Resources.getSystem().getDimensionPixelSize( Resources.getSystem().getIdentifier("navigation_bar_height", "dimen", "android")); }
From source file:Main.java
public static int dp2px(int dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); }
From source file:Main.java
public static float pxToDp(float px) { float densityDpi = Resources.getSystem().getDisplayMetrics().densityDpi; return px / (densityDpi / 160f); }
From source file:Main.java
public static final int dpToPx(int dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); }
From source file:Main.java
public static int px2dp(float pxValue) { final float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); }
From source file:Main.java
public static int dp2px(float dipValue) { final float scale = Resources.getSystem().getDisplayMetrics().density; return (int) (dipValue * scale + 0.5f); }
From source file:Main.java
public static int px2sp(float pxValue) { final float fontScale = Resources.getSystem().getDisplayMetrics().scaledDensity; return (int) (pxValue / fontScale + 0.5f); }
From source file:Main.java
public static int GetScreenWidth() { return Resources.getSystem().getDisplayMetrics().widthPixels; }
From source file:Main.java
public static int GetScreenHeight() { return Resources.getSystem().getDisplayMetrics().heightPixels; }