3

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?

Bolic
  • 705
  • 2
  • 12
  • 30
  • Are you referring to the ActionBar's title, which shows as "TopView 1", "App Name," or "TopView 2" in the images on the [Navigation Drawer documentation](http://developer.android.com/design/patterns/navigation-drawer.html)? – Bryan Herbst Jul 23 '13 at 17:54
  • yes. The text close to the app icon, which is also the button to open/close the drawer... also i used the sample from google.... so i must to find out where i can see/edit this default drawer_layout, which is from google it self, to find the right textView – Bolic Jul 23 '13 at 18:36

2 Answers2

1

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);
Community
  • 1
  • 1
Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • 1
    Personally, I find setting a simple marked up `Spannable` as title much less hacky (the 2nd rated answer to the question liked). I guess it's a matter of opinion, but I'd find creating a custom view just for the purpose of having a different title appearance a lot more cumbersome. – MH. Jul 23 '13 at 19:22
  • I have just known the thread you linked. But its seems that i did something wrong last time. Now it is working. Thanks ;) – Bolic Jul 24 '13 at 17:04
0

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

Reference: How to change the font on the TextView?

Community
  • 1
  • 1
Ryan S
  • 4,549
  • 2
  • 21
  • 33
  • I seen this discussion before, but it does not work without knowing the textView...The problem of the XML way (creating new apptheme with other font), is that than the api lvl 16 is required... so i want to find the right textView. But this is not possible without knowing where the layout is saved – Bolic Jul 23 '13 at 18:38