Here you can find the source of dipToPixel(int dip)
Parameter | Description |
---|---|
dip | the value of the dip. |
public static int dipToPixel(int dip)
//package com.java2s; //License from project: Apache License import android.content.res.Resources; public class Main { final static float scale = Resources.getSystem().getDisplayMetrics().density; /**/*ww w . ja v a 2s. com*/ * Converts DIP to pixels. * * @param dip * the value of the dip. * @return the value of the pixels. */ public static int dipToPixel(int dip) { return (int) (dip * scale + 0.5f); } }