appcompat - Android Support Toolbar Styling -
i trying implement light theme of appcompat dark toolbar (action bar), when adding toolbar dynamically or using <include />
text fails display in correct color (black instead of white). default action bar styled correctly, when add toolbar not.
here code:
toolbar.xml
<android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" app:theme="@style/apptheme" android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="?attr/actionbarsize" app:navigationcontentdescription="@string/abc_action_bar_up_description" android:background="?attr/colorprimary" app:navigationicon="?attr/homeasupindicator" app:title="@string/action_settings" />
styles.xml
<resources> <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <!-- customize theme here. --> <item name="colorprimary">#ff299725</item> <item name="colorprimarydark">#ff1d691b</item> <item name="coloraccent">#ff5fb10b</item> </style> </resources>
however in preview , live environment:
i have tried different versions of appcompat (v.22.1, v.22.2, v.21.0.3) replicate issue, have tried adding styles textcolor
, happens styles white.
any legends?
in toolbar.xml, remove app:theme
attribute , use instead:
android:theme="@style/themeoverlay.appcompat.dark.actionbar"
also, depending on how you're implementing toolbar, may want change base theme (in styles.xml) use noactionbar
variant, so:
<!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.noactionbar">
Comments
Post a Comment