thieumao

convertDpToPx

Apr 17th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.19 KB | None | 0 0
  1.     public static float convertDpToPx(Context context, float dp) {
  2.         Resources res = context.getResources();
  3.  
  4.         return dp * (res.getDisplayMetrics().densityDpi / 160f);
  5.     }
Advertisement
Add Comment
Please, Sign In to add comment