📜  android studio dp 到 px - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:21.246000             🧑  作者: Mango

代码示例1
// Converts 14 dip into its equivalent px
float dip = 14f;
Resources r = getResources();
float px = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP,
    dip,
    r.getDisplayMetrics()
);