当前位置: 代码迷 >> Android >> android 将DIP转入PIXEL
  详细解决方案

android 将DIP转入PIXEL

热度:46   发布时间:2016-05-01 15:20:26.0
android 将DIP转为PIXEL
It uses pixels, but I'm sure you're wondering how to use dips instead. The answer is in TypedValue.applyDimension(). Here's an example of how to convert dips to px in code:

// Converts 14 dip into its equivalent pxResources r = getResources();float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics());


原文地址:http://stackoverflow.com/questions/2406449/does-setwidthint-pixels-use-dip-or-px
  相关解决方案