How change font type in NumberPicker. I try to do like this, but font not changing. Any idea? P.S: color and textSize are change.
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);
}
}
}
Font and path work correctly. I use it for my custom text views.