Here you can find the source of dipValue(Context context, int dip)
public static int dipValue(Context context, int dip)
//package com.java2s; import android.content.Context; import android.util.TypedValue; public class Main { public static int dipValue(Context context, int dip) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, context.getResources().getDisplayMetrics()); }//from ww w. j a v a 2s . co m }