Here you can find the source of dipToPixels(Context context, float dipValue)
public static float dipToPixels(Context context, float dipValue)
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; import android.util.TypedValue; public class Main { public static float dipToPixels(Context context, float dipValue) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics);/*from ww w .j a v a2 s. c o m*/ } }