2

I am using Three NumberPickers to create a DatePicker in different calendar system, and trying to set typeface to NumberPicker controls. according to this post on SO, i looked at number_picker.xml. the numberpicker is created using two ImageButton and one EditText as Follows:

<merge>
    <ImageButton ... />
    <EditText .../>
    <ImageButton ... />
</merge>

so, as a sample, i used the following code for year NumberPickers:

NumberPicker date_y = (NumberPicker) findViewById(R.id.np_year);
Typeface tf;
tf = Typeface.createFromAsset(getAssets(),"fonts/bnazaninbd.ttf");
EditText et = (EditText) date_y.getChildAt(0);
et.setTypeface(tf);

1st problem is why getChildAt(0) works for Edit text, though Edit text is 2nd object and it should be getChildAt(1).

2nd, the editText font changes when the Activity loads (but just the EditText, and not to texts at above and bottom of it), but as the numberpicker slids, the Typeface changes back to its original.

Community
  • 1
  • 1
Ali sh
  • 365
  • 3
  • 13
  • ok... i found the answer [here](http://stackoverflow.com/questions/22962075/change-the-text-color-of-numberpicker) on SO. it's about numberpicker's text color, but by replacing setTextColor(color) to setTypeface([Typeface]) does what i need. – Ali sh Jun 09 '14 at 15:56
  • Man I tried to do this, but doesn't work, any idea so how could I do this??? – Ciro Mine Feb 19 '16 at 19:21

1 Answers1

-2

We can easily apply font(TTF) using this fontify lib. Check the complete woking demo here

Mukesh Y
  • 742
  • 6
  • 15
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Dan Getz Jun 21 '15 at 00:39