Android 技巧: 用TypedValue将125dp转化为px单位的数值

来源:互联网 发布:ubuntu安装时自动分区 编辑:程序博客网 时间:2024/06/10 04:00

float inPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 125f, getResources().getDisplayMetrics());


1.  // dip: The unit to convert from

2. // 125 : The value to apply the unit to.

3. // Current display metrics to use in the conversion -- supplies display density and scaling information.

将125dp转化为以px为单位的数值。

0 0
原创粉丝点击