How to change the text on the action bar

前端 未结 18 1074
春和景丽
春和景丽 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:28

    try do this...

    public void onCreate(Bundle savedInstanceState) 
    {
    super.onCreate(savedInstanceState);
        this.setTitle(String.format(your_format_string, your_personal_text_to_display));
        setContentView(R.layout.your_layout);
           ...
           ...
    }
    

    it works for me

提交回复
热议问题