kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

Whether can actionBar title change #47

Open guoyoujin opened 9 years ago

guoyoujin commented 9 years ago

ActionBar title can change, I tried to change, is not what I want effect

kanytu commented 9 years ago

What have you tried so far?

guoyoujin commented 9 years ago

@kanytu

@Override public void onNavigationDrawerItemSelected(int position) { // Toast.makeText(this, "Menu item selected -> " + position, Toast.LENGTH_SHORT).show(); // mToolbar.setTitle("Menu item selected -> " + position); initFragmentTrans(); switch (position) { case 0: initNewsFragment(); mTitle = "NewsFragment"; mToolbar.setTitle(mTitle); break; case 1: initGoddessFragment(); mTitle = "Goddess"; mToolbar.setTitle(mTitle); break; case 2: initWeatherFragment(); mTitle = "Weather"; mToolbar.setTitle(mTitle); break; case 3: break; default:

    }
kanytu commented 9 years ago

You're not supposed to use mToolbar.setTitle.

Call getSupportActionBar().setTitle instead

guoyoujin commented 9 years ago

@kanytu I'll try, because I use is mToolbar