get Pixel From Dip - Android Graphics

Android examples for Graphics:Pixel

Description

get Pixel From Dip

Demo Code


//package com.java2s;

import android.content.Context;

public class Main {
    static public float getPixelFromDip(Context cxt, float dip) {
        float density = cxt.getResources().getDisplayMetrics().density;
        return (dip * density + 0.5f);
    }//from w w  w. j  av a2  s.  co m
}

Related Tutorials