Here you can find the source of sp2px(float sp, Context context)
public static float sp2px(float sp, Context context)
//package com.java2s; import android.content.Context; public class Main { public static float sp2px(float sp, Context context) { final float scale = context.getResources().getDisplayMetrics().scaledDensity; return sp * scale; }//from w w w . j a va 2s .c o m }