dp To Px - Android Graphics

Android examples for Graphics:Pixel

Description

dp To Px

Demo Code


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

import android.util.TypedValue;

public class Main {
    public static int dpToPx1(Context context, int dp) {
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                dp, context.getResources().getDisplayMetrics());
    }//  w ww  .  j a va2s .com
}

Related Tutorials