get Pixel from DIP value - Android Graphics

Android examples for Graphics:Pixel

Description

get Pixel from DIP value

Demo Code


//package com.java2s;

import android.content.Context;

import android.util.TypedValue;

public class Main {
    public static float getPX(Context context, int dipValue) {
        return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                dipValue, context.getResources().getDisplayMetrics());
    }//from  ww  w . j  ava2s  . c  o  m
}

Related Tutorials