[英]How to change the toolbar's title in android app?
My android app has a toolbar and I wan to change the title of it. 我的Android应用程序有一个工具栏,我想更改它的标题。 I used toolbar.setTitle() but it is not working... Please help.
我使用了toolbar.setTitle(),但是它不起作用...请帮助。 What should I do?
我该怎么办? I tried getSupportActionBar().setTitle() but it doesn't work.
我尝试了getSupportActionBar()。setTitle(),但是它不起作用。
Try to use this.setTitle(title);
尝试使用
this.setTitle(title);
in onCreate()
method. 在
onCreate()
方法中。
Use below code to set the title 使用以下代码设置标题
Toolbar mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(mActionBarToolbar);
getSupportActionBar().setTitle("My title");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.