How to reduce the width of Android popup menu?

I have implemented a popup menu for each list item, the problem is when I click on the image opening the popup menu. The pop-up menu is too wide.

I need to reduce the width of the popup menu. Currently I have reduced the height, text size, text color, separator size and color and back color.

By modifying the below changes in the style.xml file (v-14 and v-11 values โ€‹โ€‹folder):

<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <!-- API 14 theme customizations can go here. -->

    <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">30dp</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">#dcdbdb</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">15sp</item>
</style>

 <!-- Change Overflow Menu Background -->
 <style name="PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">#e3e3e3</item>
</style>

      

need help ... thanks in advance.

+3


source to share





All Articles