android像素密度适配

    xiaoxiao2021-03-25  232

    public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale); } public static int px2dip(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (pxValue / scale); }
    转载请注明原文地址: https://ju.6miu.com/read-686.html

    最新回复(0)