我有以下设置:
toolbar.xml
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.citylifta"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:theme="@style/ActionBarTheme" />
的themes.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="actionBarTheme">@style/ActionBarTheme</item>
</style>
<style name="ActionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textAllCaps">true</item>
<item name="android:background">@color/dark_button</item>
</style>
现在,如果我省略了attr app:theme="@style/ActionBarTheme"
,工具栏就会变成黑色......
如何正确定义工具栏的样式作为AppTheme的一部分?