How to change background color option menu xamarin android -




i try change background color option menu black white code not work.i see link how change background color popup menu android not work me.

styles

  <style name="theme.designdemo" parent="base.theme.designdemo">   </style>    <style name="base.theme.designdemo" parent="theme.appcompat.light.noactionbar">     <item name="colorprimary">@color/colorprimary</item>       <item name="popupmenustyle">@style/popupmenu</item>     <item name="colorprimarydark">@color/colorprimarydark</item>      </style> <style name="popupmenu" parent="widget.appcompat.popupmenu">     <item name="android:popupbackground">@android:color/white</item>  </style>  </resources> 

popup_menu.xml:

<?xml version="1.0" encoding="utf-8" ?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">   <!--///showasaction="always" ///-->   <item android:id="@+id/action_settings" android:title="share" showasaction="always" />   <item android:id="@+id/action_settings1" android:title="bluetooth" showasaction="always" />   <item android:id="@+id/action_settings2" android:title="exit" showasaction="always" />   <!--/android:showasaction="ifroom"/-->   <item android:id="@+id/action_settings3" android:title="share" android:showasaction="ifroom" />   <item android:id="@+id/action_settings4" android:title="bluetooth" android:showasaction="ifroom" /> </menu> 

how change background color option menu

have controlled context passed constructor? when create popupmenu class, please use activity context :

popupmenu popup = new popupmenu(this, anchorview);//not basecontext 

whether use android.widget.popupmenu or android.support.v7.widget.popupmenu? governed different theme attributes :

 <style name="apptheme" parent="theme.appcompat.light.noactionbar">      <!-- if using android.widget.popupmenu -->      <item name="android:popupmenustyle">@style/popupmenu</item>      <!-- if using android.support.v7.widget.popupmenu -->      <item name="popupmenustyle">@style/popupmenu</item>  </style/>   <style name="popupmenu" parent="widget.appcompat.popupmenu">      <item name="android:popupbackground">@android:color/white</item>  </style> 

effect this.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -