Reduce Menu items width,height and textview size

后端 未结 4 1701
太阳男子
太阳男子 2020-12-13 16:07

I had done a menu overflow items.I need to reduce menu items width,height and textview size.

I referred this post.But it is not working for me.I am posted the code a

相关标签:
4条回答
  • 2020-12-13 16:20

    The best option I think is to use meny item action layout.

    app:actionLayout="@layout/my_custom_layout"

    and then infiltrate it.

    0 讨论(0)
  • 2020-12-13 16:22

    use this :

    <item name="android:listPreferredItemHeightSmall">72dp</item>
    

    Example:

     <style name="popupMenuStyle" parent="@android:style/Widget.PopupMenu">
            <item name="android:popupBackground">@drawable/dropdown_bg</item>
           <item name="android:itemPadding">25dp</item>
           <item name="android:listPreferredItemHeightSmall">70dp</item>
    
    
        </style>
    
    0 讨论(0)
  • 2020-12-13 16:23

    I can reduce the height and text size of the menu items with the help of below codes:

    res/values/styles.xml:

        <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
     
            <item name="android:dropDownListViewStyle">@style/PopupMenuListView</item>
            <item name="android:actionBarWidgetTheme">@style/PopupMenuTextView</item>
            <item name="android:popupMenuStyle">@style/PopupMenu</item>
     
            <!-- Change Overflow Menu ListView Item Height & Property -->
            <item name="android:listPreferredItemHeightSmall">10dp</item>
            <item name="android:listPreferredItemPaddingLeft">5dp</item>
            <item name="android:listPreferredItemPaddingRight">5dp</item>
        </style>
     
        <!-- Change Overflow Menu ListView Divider Property -->
        <style name="PopupMenuListView" parent="@android:style/Widget.Holo.ListView.DropDown">
            <item name="android:divider">#FF0000</item>
            <item name="android:dividerHeight">2dp</item>
        </style>
     
        <!-- Change Overflow Menu ListView Text Size and Text Size -->
         <style name="PopupMenuTextView" parent="@style/android:Theme.Holo.Light">
            <item name="android:textColor">#00FF00</item>
            <item name="android:textSize">5sp</item>
        </style>
     
         <!-- Change Overflow Menu Background -->
         <style name="PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
            <item name="android:popupBackground">#888888</item>
        </style>
     
    </resources>
    

    Add the above codes in styles.xml(v11) and styles.xml(v14).

    For More Detail:

    Refer Action Bar Overflow Menu Customization

    0 讨论(0)
  • 2020-12-13 16:23

    In style.xml add this

    <item name="android:listPreferredItemHeightSmall">35dp</item>
            <item name="android:listPreferredItemPaddingLeft">5dp</item>
            <item name="android:listPreferredItemPaddingRight">5dp</item>
    
    0 讨论(0)
提交回复
热议问题