android - How to change color of toolbar options background -
i want change light background of options in toolbar section appears when trying copy something. it's bad right now:
here styles.xml :
<?xml version="1.0" encoding="utf-8" ?> <resources> <style name="mytheme.base" parent="theme.appcompat.light.noactionbar"> !-- customizations not specific particular api-level can go here. --> <item name="windownotitle">true</item> <item name="colorprimary">@color/primary</item> <item name="colorprimarydark">@color/primary_dark</item> <item name="coloraccent">@color/accent</item> <item name="android:textcolorprimary">@color/primary_text</item> <item name="android:textcolorsecondary">@color/secondary_text</item> </style> <!-- application theme. --> <style name="mytheme" parent="mytheme.base"> </style> <style name="mytheme.toolbar" parent="mytheme.base"> <item name="android:textcolorprimary">@android:color/white</item> <item name="android:textcolorsecondary">@android:color/white</item> </style> <style name="mytheme.navmenu" parent="mytheme.base"> <item name="android:textcolorprimary">@color/gray</item> </style> <style name="mytheme.rightmenu" parent="mytheme.base"> <item name="android:textcolorprimary">@color/black</item> </style> </resources>
as may have noticed i'm using noactionbar
because i'm using toolbar. it's on main.xml :
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <!-- content layout --> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!-- toolbar instead of actionbar drawer can slide on top --> <android.support.v7.widget.toolbar android:id="@+id/toolbar" app:theme="@style/mytheme.toolbar" android:layout_width="match_parent" android:layout_height="@dimen/abc_action_bar_default_height_material" android:background="?attr/colorprimary" android:minheight="?attr/actionbarsize" /> <!-- real content goes here --> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> </linearlayout> <android.support.design.widget.navigationview android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:id="@+id/nav_view" app:headerlayout="@layout/nav_view_header" app:menu="@layout/nav_view_menu" app:theme="@style/mytheme.navmenu" /> </android.support.v4.widget.drawerlayout>
try in toolbar:
app:theme="@style/themeoverlay.appcompat.dark.actionbar"
appcompat toolbar popuptheme not used in shareaction menuitem
and here appbarlayout
:
<android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" app:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbarmain" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@color/colorprimary" app:layout_collapsemode="pin" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/themeoverlay.appcompat.light" app:theme="@style/themeoverlay.appcompat.dark.actionbar" />
take @ also:
app:popuptheme="@style/themeoverlay.appcompat.light"
Comments
Post a Comment