欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[随笔]设置PopupMenu Style

程序员文章站 2022-03-21 11:07:01
...

1、设置背景颜色

<color name="popupwindow_background">#303030</color>

2、设置PopupMenu的style--android:popupBackground

<style name="Theme.PopupMenu" 
       parent="@android:style/Widget.Holo.Light.ListPopupWindow">
       <item name="android:popupBackground">@color/popupwindow_background</item>
</style>

3、将PopupMenu的style加载到Activity需要的style中--android:popupMenuStyle

<style name="Theme.InCallScreen" 
       parent="@android:style/Theme.Holo.NoActionBar">
        <item name="android:popupMenuStyle">@style/Theme.PopupMenu</item>
</style>

4、设置Activity需要的style--android:theme,因为要显示popupmenu的style

<activity android:name="InCallScreen"
          android:theme="@style/Theme.InCallScreen">
</activity>


从以下地址搜索到有关信息

How to set the background of Android PopupMenu to White

转载于:https://my.oschina.net/suxiaodai/blog/189792