|
|
@@ -8,6 +8,7 @@ import android.support.annotation.ArrayRes;
|
|
|
import android.support.annotation.ColorRes;
|
|
|
import android.support.annotation.IdRes;
|
|
|
import android.support.annotation.StringRes;
|
|
|
+import android.util.TypedValue;
|
|
|
|
|
|
import kr.co.zumo.app.lifeplus.application.App;
|
|
|
|
|
|
@@ -88,4 +89,16 @@ public class ResourceUtil {
|
|
|
return App.getInstance().getContext().getResources().getColorStateList(colorId);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * DP to pixel
|
|
|
+ *
|
|
|
+ * @param dp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static int dpToPx(float dp) {
|
|
|
+ //(dp * App.getInstance().getContext().getResources().getDisplayMetrics().density + 0.5f);
|
|
|
+ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, App.getInstance().getContext().getResources().getDisplayMetrics());
|
|
|
+ }
|
|
|
+
|
|
|
}
|