i using custom action bar in android app. trying give custom theme not working.
app_bar.xml:
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.toolbar> app_bar included in action_main.xml:
<include android:id="@+id/app_bar" layout="@layout/app_bar" /> styles.xml has no action bar parent:
<resources> <!-- inherit material theme --> <style name="apptheme" parent="theme.appcompat.noactionbar"> <!-- main theme colors --> <!-- app branding color app bar --> <item name="colorprimary">@color/primary</item> <!-- darker variant status bar , contextual app bars --> <item name="colorprimarydark">@color/primary_dark</item> <!-- theme ui controls checkboxes , text fields --> <item name="coloraccent">@color/accent</item> </style> </resources> in android manifest file using above theme:
android:theme="@style/apptheme" in main activity :
toolbar = (toolbar) findviewbyid(r.id.app_bar); toolbar.setlogo(r.mipmap.ic_launcher); toolbar.settitle(" ringtone control"); setsupportactionbar(toolbar); but, not getting custom theme color. missing?
per this +android developers pro-tip, if using toolbar need set background color:
<android.support.v7.widget.toolbar android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorprimary" /> only default action bar colorprimary default.
Comments
Post a Comment