Reputation: 307
That is a weird issue, still can't find out why? Setting up custom toolbar like below,
<android.support.v7.widget.Toolbar
....>
<include android:id="@+id/custom_toolbar" layout="@layout/custom_toolbar"/>
</android.support.v7.widget.Toolbar>
and textview in custom toolbar
<TextView
.....
android:text="@string/search_by_title_or_artist"
android:textColor="@color/text_shadow_white"
.... />
and style in theme
<style name="AppTheme" parent="BaseTheme">
.....
<item name="android:textColorPrimary">@color/material_gray_900</item>
.....
</style>
final is BaseTheme
<style name="BaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowContentTransitions">true</item>
</style>
the issue is text color in custom toolbar is not overrided by android:textColor
attribute no matter set any color. it is only be affected by android:textColorPrimary
in theme style. but other texts not in custom toolbar like in list will be overrided by android:textColor
.
Please tell me what wrong with that and how to fix.
Upvotes: 0
Views: 499
Reputation: 714
Try this
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:text="Search..."
android:textColor="@color/colorPrimary"
android:layout_height="wrap_content"/>
</android.support.v7.widget.Toolbar>
Upvotes: 0
Reputation: 2265
First customize your style.xml
like this :-
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
then apply into your custom toolbar
:-
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" >
<TextView
.....
android:text="@string/search_by_title_or_artist"
android:textColor="@color/text_shadow_white"
....
/>
</android.support.v7.widget.Toolbar>
Upvotes: 1
Reputation: 12648
try this it may help you.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/bg_transition"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
Upvotes: 0