-1

I would like to change the default font of the words in an android app with a java program.

Here is part of the code:

/**************************
 *
 * UI Display andMap Implementation method
 *
 **************************/

//The sorting method selection Spinner
private void setSpinner() {
    List<String> list = new ArrayList<String>();
    list.add(getString(R.string.sort_suggested));
    list.add(getString(R.string.sort_price));
    list.add(getString(R.string.sort_duration));

    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this.getActivity(), R.layout.spinner_layout, list);
    dataAdapter.setDropDownViewResource(R.layout.spinner_inner_layout);
    sortSpinner.setAdapter(dataAdapter);
}

How should I change the font on those list.add(getString....) comment?

Kennedy Kan
  • 273
  • 1
  • 7
  • 20
  • 1
    possible duplicate of [How to change the font on the TextView?](http://stackoverflow.com/questions/2888508/how-to-change-the-font-on-the-textview) – IKavanagh Aug 21 '15 at 13:05
  • Maybe this helps [How to Change Your Spinner Typeface](http://goo.gl/3Fj50A) – endasan Aug 21 '15 at 13:11

1 Answers1

1

exemple:

Typeface tf = Typeface.createFromAsset(getAssets(),
                "fonts/DroidSansFallback.ttf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf);
  • While this code may answer the question, providing additional context regarding _how_ and/or _why_ it solves the problem would improve the answer's long-term value. – spongebob Aug 21 '15 at 15:37