Question

i am new to android so i have got a quite basic question. I am trying to change the font of the text in my navigation drawer, but i do not know how to get this textview...

i am talking of the title above and not the textviews of the sliding menu...

my concret question:

where can i find the drawer_layout to get the id of the textview of the navigation drawer?

mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

I find out which layout i am using for the drawer, but it is not part of the layouts i created. where can i find these one? In the end i want to call the methode setTypface() to change the font. Is that the right way?

Était-ce utile?

La solution

First, please note that the title you are referring to is not a part of the DrawerLayout; rather it is the title in the Action Bar.

There is no officially supported method of changing the Action Bar's title font. However, there are some workarounds in this StackOverflow question . The least hackish way to do it (and the accepted answer to the linked question) is to create your own custom Action Bar layout containing just a TextView, and setting that as so:

getActionBar().setDisplayShowTitleEnabled(false);
getActionBar().setCustomView(myCustomView);

Autres conseils

You can change the font in your xml with android:typeface

Reference: How to change the font on the TextView?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top