Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.util.TypedValue; public class Main { /** * sp*ppi/160 =px * * @param ctx * @param dip * @return */ public static int spToPX(final Context ctx, float sp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, ctx.getResources().getDisplayMetrics()); } }