标签:
// dp转化为像素 public int Dp2Px(Context context, float dp) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dp * scale + 0.5f); } // 像素转化为dp public int Px2Dp(Context context, float px) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (px / scale + 0.5f); }
标签:
原文地址:http://www.cnblogs.com/H-BolinBlog/p/5344654.html