android - Custom PopupMenu styles are being ignored -
i've been struggling popupmenu styling, , after lot of research, process of creating custom popupmenu style theme seemed straightfoward. example answer on this question seems easy way change background color of popupmenu. however, none of these solutions have worked project. started digging style sources find out should inheriting style popupmenu in own project.
i'm running tests on handset running api 19, , base theme looks this:
<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <!-- ... --> <item name="android:popupmenustyle">@style/custompopupmenu</item> </style> <style name="custompopupmenu" parent="@style/widget.appcompat.light.popupmenu"> <item name="android:popupbackground">@color/retina_burning_hot_pink</item> </style>
this solution of accepted answers here show. not style popupmenu. dug sources find geneology of theme , see default settings being used. found:
<style name="theme.appcompat.light.darkactionbar" parent="base.theme.appcompat.light.darkactionbar"/> <style name="base.theme.appcompat.light.darkactionbar" parent="base.theme.appcompat.light"> <style name="base.theme.appcompat.light" parent="base.v7.theme.appcompat.light"/>
and in base.v7.theme.appcompat.light
found these default settings:
<!-- popup menu styles --> <item name="popupmenustyle">@style/widget.appcompat.light.popupmenu</item> <item name="textappearancelargepopupmenu">@style/textappearance.appcompat.light.widget.popupmenu.large</item> <item name="textappearancesmallpopupmenu">@style/textappearance.appcompat.light.widget.popupmenu.small</item> <item name="listpopupwindowstyle">@style/widget.appcompat.listpopupwindow</item> <item name="dropdownlistviewstyle">?android:attr/dropdownlistviewstyle</item>
so far can tell, theme inherits theme.appcompat.light.darkactionbar
uses default popupmenu style of @style/widget.appcompat.light.popupmenu
. inherit style set own popupmenu settings. made sure activity , application using correct theme. i'm not sure why else won't work. i've tried these settings:
<item name="android:textappearancelargepopupmenu">@style/custompopupmenularge</item> <item name="android:textappearancesmallpopupmenu">@style/custompopupmenusmall</item> <item name="android:popupwindowstyle">@style/custompopupmenulistwindow</item>
i provided custom styles each one, , none of them worked. overriding custom styles? appreciated, because i'm stumped.
edits
here's manifest...
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.blah.blah"> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".activities.mainactivity" android:label="@string/app_name" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
here apptheme.noactionbar
<style name="apptheme.noactionbar"> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> </style>
i think need define parent appcompat.noactionbar
. try parent="theme.appcompat.light.noactionbar"
, add in <item name="android:popupmenustyle">@style/custompopupmenu</item>
it.
Comments
Post a Comment