How to change font type in NumberPicker. I try to do so, but the font does not change. Any ideas? PS: color and textSize are changing.
public class NumberPicker extends android.widget.NumberPicker { private Context context; private Typeface tfs; public NumberPicker(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; tfs = Typeface.createFromAsset(context.getAssets(),"fonts/font.ttf"); } @Override public void addView(View child) { super.addView(child); updateView(child); } @Override public void addView(View child, int index, android.view.ViewGroup.LayoutParams params) { super.addView(child, index, params); updateView(child); } @Override public void addView(View child, android.view.ViewGroup.LayoutParams params) { super.addView(child, params); updateView(child); } private void updateView(View view) { if(view instanceof EditText){ ((EditText) view).setTypeface(tfs); ((EditText) view).setTextSize(25); ((EditText) view).setTextColor(Color.RED); } } }
The font and path are working correctly. I use it for my custom text views.
source share