pixels Per Dip - Android Graphics

Android examples for Graphics:Pixel

Description

pixels Per Dip

Demo Code


//package com.java2s;
import android.content.Context;

public class Main {
    public static float pixelsPerDip(Context context) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (scale + 0.5f) / 160;
    }/*from   ww w .j  a va2  s  . c om*/
}

Related Tutorials