Reputation: 411
i want to customize color of toolbar but changes in custom style for toolbar not work.
i use appcompat 'com.android.support:appcompat-v7:22.1.1'
in toolbar i set:
<android.support.v7.widget.Toolbar
android:theme="@style/StyleTest"
(also i try app:theme but these too not effect)
this is my toolbar style:
<style name="StyleTest" parent="Theme.AppCompat.NoActionBar">
<item name="android:textColorPrimary">@color/green</item>
<item name="actionMenuTextColor">@color/yellow</item>
<item name="android:textColorSecondary">@color/red</item>
</style>
and this style not work. but when i change my app style items, this also changed in a toolbar (while the toolbar has own style in android:theme value). for example when i change app style item "textColorSecondary" this also change back arrow in toolbar, but i want different color in toolbar style and app style. this is app style:
<!-- Application theme. -->
<style name="AppTheme" parent="MaterialDrawerTheme.Light.DarkToolbar">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<!-- colorPrimary is a toolbar background -->
<item name="colorPrimary">#5EB1F7</item>
<!-- colorAccent color of pressed widget -->
<item name="colorAccent">@color/blue_dark</item>
<item name="actionModeBackground">@color/black_half_transparent</item>
<item name="android:textColor">@color/black</item>
<!-- textColorPrimary is a color of the title for Toolbar -->
<item name="android:textColorPrimary">@color/white</item>
<!-- colorPrimaryDark is a color for lollipop system bar -->
<item name="colorPrimaryDark">@color/material_drawer_background</item>
<!-- android:textColorSecondary is the color of the back arrow and menu
overflow icon (three vertical dots) -->
<item name="android:textColorSecondary">@color/blue</item>
</style>
when i change app style items, e.g. colorPrimary or textColorPrimary or textColorSecondary this applied to Toolbar, but toolbar own style is ignored. How i can apply custom style to toolbar?
Upvotes: 3
Views: 1317
Reputation: 1531
I guess you need to use style in this way:
<android.support.v7.widget.Toolbar
style="@style/StyleTest" />
Baware of style
without android:
prefix.
Upvotes: 0
Reputation: 2504
Use app:theme
in xml and remove android:
prefix from StyleTest's properties.
Upvotes: 0