toolbar

自己总是记不住这些位置的名称,做个记录toolbar_第1张图片

在v7包中的ToolBar使用setTitle(title)是将其放在

setSupportActionBar(toolbar);

之前,否则没有作用。

另外,在AndroidManifest.xml中application中的theme与activity中的theme都使用

@style/AppTheme

或者 activity使用

android:theme="@style/AppTheme.PopupOverlay"

时会出现Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead这个错误 ,当两个中的其中一个theme设置为

android:theme="@style/AppTheme.NoActionBar"

就不出错了,我自己是这样解决的,但不知道什么原因,也不知道是不是所有的这个问题都可以这么解决,原因及其他解决方法继续研究。

activity_main.xml

toolbar_第2张图片

style.xml

你可能感兴趣的:(toolbar,setTitle)