I've PopUpMenu
with support library v7 in my application which works as expected. But styling PopUpMenu
is not working with styles of actionbarcompat
.
styles.xml
in values as follows :
<style name="Theme.Tellus" parent="@style/Theme.AppCompat.Light">
<item name="popupMenuStyle">@style/PopupMenu.Tellus</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Tellus</item>
</style>
<style name="PopupMenu.Tellus" parent="@style/Widget.AppCompat.Light.PopupMenu">
<item name="android:listSelector">@drawable/selectable_background_tellus</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel_tellus</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="DropDownListView.Tellus" parent="@style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_tellus</item>
<item name="android:background">@color/background_actionbar</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:divider">@android:color/white</item>
<item name="android:dividerHeight">1dp</item>
</style>
Here is output what I'm getting after applying theme.
It does display background of PopUpMenu
in blue color which is applied from dropDownListViewStyle
. How come PopUpMenu
using dropDownListViewStyle
? If it's using then it should use all attributes of dropDownListViewStyle
I want to change MenuItem textColor
to white
which fits to my theme. How can one apply style to MenuItem
textColor?
Any enlightenment will be welcomes
try like this -
<style name="Theme.Tellus" parent="@style/Theme.AppCompat.Light">
<item name="popupMenuStyle">@style/PopupMenu.Tellus</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Tellus</item>
<item name="android:textColor">#FF0000</item>
</style>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.