Android How To Use Scaled Pixel Or Font

First, create an Android XML file resource under “res/values” called “dimensions.xml” of resource type “value”. Using the editor, add a new Dimension of any name and the value of your choice.

<dimen name=”custom_text_size”>16sp</dimen>

//set size example 1
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 65);
//example 2
setTextSize(convertView.getResources().getDimensionPixelSize(R.dimen.custom_text_size));