transform To Density Pixel - Android Graphics

Android examples for Graphics:Pixel

Description

transform To Density Pixel

Demo Code


//package com.java2s;

import android.util.DisplayMetrics;

public class Main {
    public static int transformToDensityPixel(int regularPixel,
            DisplayMetrics displayMetrics) {
        return transformToDensityPixel(regularPixel,
                displayMetrics.densityDpi);
    }/*  www .j a v a  2s  .  c  o m*/

    public static int transformToDensityPixel(int regularPixel,
            float densityDpi) {
        return (int) (regularPixel * densityDpi);
    }
}

Related Tutorials