menu-普通menu弹出框样式

今天接触到了menu弹出框样式。主要就是在theme下进行调整。现在把接触到的知识点总结一下。

在theme中,跟menu有关的几个属性如下

<item name="panelBackground">@android:drawable/menu_panel_color_funui</item>
        <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
        <!-- These three attributes do not seems to be used by the framework. Declared public though -->
        <item name="panelColorBackground">#000</item>
        <item name="panelColorForeground">?android:attr/textColorPrimary</item>
        <item name="panelTextAppearance">?android:attr/textAppearance</item>

        <item name="panelMenuIsCompact">true</item>
        <item name="panelMenuListWidth">250dip</item>
        <item name="panelMenuListTheme">@android:style/Theme.Funui.CompactMenu</item>

今天接触到的是一下几个

<item name="panelBackground">@android:drawable/menu_panel_color_funui</item>

决定的是menu弹出框的背景颜色。看效果

 

<item name="panelBackground">#0000ff</item>

结果

 

<item name="panelMenuListWidth">250dip</item>

决定的是弹出框的宽度
 看效果(“搜索“两个字位置)

<item name="panelMenuListWidth">100</item>

 

<item name="panelMenuListTheme">@android:style/Theme.Funui.CompactMenu</item>

这个主要是决定了弹出框的样式,包括每个Item的字体颜色跟大小,item之间分割线颜色,弹出框动画等。

它的内容如下

    <style name="Theme.Funui.CompactMenu">
    <!-- Menu/item attributes -->
        <item name="android:itemTextAppearance">@style/Email.Theme.Menu.TextAppearance</item>
        <item name="android:listViewStyle">@style/Email.Theme.ListView.Menu</item>
        <item name="android:windowAnimationStyle">@style/Email.Theme.Menu.Animation</item>
        <item name="android:background">@null</item>
    </style>

它几个属性如下

 

   <style name="Email.Theme.Menu.Animation" parent="@style/Animation.AppCompat.DropDownUp">
        <item name="android:windowEnterAnimation">@anim/menu_enter_from_bottom</item>
        <item name="android:windowExitAnimation">@anim/menu_out_from_bottom</item>
    </style>

动画效果。不做解释

    <style name="Email.Theme.Menu.TextAppearance" parent="@style/Base.TextAppearance.AppCompat.Medium">
        <item name="android:textSize">@dimen/panel_menu_text_size</item>
        <item name="android:textColor">@color/panel_menu_text_color</item>
    </style>

字体大小跟颜色,不解释

   <style name="Email.Theme.ListView.Menu" parent="@style/Base.Widget.AppCompat.ListView.Menu">
        <item name="android:divider">@color/panel_listview_menu_divider_color</item>
    </style>

分割线颜色,不解释

转载于:https://www.cnblogs.com/zhangshuli-1989/p/zhangshuli_menu_15528203.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值