How to change the text on the action bar

前端 未结 18 1085
春和景丽
春和景丽 2020-11-22 12:30

Currently it just displays the name of the application and I want it to display something custom and be different for each screen in my app.

For example: my home scr

18条回答
  •  佛祖请我去吃肉
    2020-11-22 13:23

    The easiest way is to call this.setTitle("...") if you are in the activity. And if you are in a fragment, just call getActivity().setTitle("...");

    This way will let you change the title anytime, no need to call it before setContentView(R.layout.activity_test);

提交回复
热议问题