List of usage examples for android.util TypedValue applyDimension
public static float applyDimension(int unit, float value, DisplayMetrics metrics)
From source file:Main.java
public static float dip2px(Context context, float dipValue) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static float convertPXtoDP(Context context, float pxVal) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, pxVal, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int dipsToPix(Context context, float dps) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dps, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int dp2px(Context context, int dp) { return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics())); }
From source file:Main.java
public static float dpToPx(Resources res, float dp) { float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, res.getDisplayMetrics()); return px;/* w w w. j ava 2 s . co m*/ }
From source file:Main.java
public static int dipToPx(Context context, float dpValue) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, context.getResources().getDisplayMetrics()); }
From source file:Main.java
private static int getDpToPx(int dp, Context context) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static float convertDPtoPX(Context context, float dpVal) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int pxToDp(final int n, final Context context) { return (int) TypedValue.applyDimension(0, (float) n, context.getResources().getDisplayMetrics()); }
From source file:Main.java
public static int getTextSize(Context context, int size) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size, context.getResources().getDisplayMetrics()); }