public class DensityUtil
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
float |
density |
| 构造器和说明 |
|---|
DensityUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
dip2px(float dpValue)
根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
static int |
dp2px(float dpValue)
根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
float |
px2dip(int pxValue)
根据手机的分辨率从 px(像素) 的单位 转成为 dp
|
static float |
px2dp(int pxValue)
根据手机的分辨率从 px(像素) 的单位 转成为 dp
|
public static int dp2px(float dpValue)
dpValue - 虚拟像素public static float px2dp(int pxValue)
pxValue - 像素public int dip2px(float dpValue)
dpValue - 虚拟像素public float px2dip(int pxValue)
pxValue - 像素