简体   繁体   中英

Android Studio how to change top bar title

I have this navigation-drawer with fragments. I want that every time I go to a section of this, change the title above in the image it says "Usario"

Image of Navigation Drawer

导航抽屉的图像

Everytime you change the fragment, set the title of your activity.

fragmentTransaction.commit();
setTitle("something");

尝试这个

((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("Usario");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM