如何减少Android中弹出菜单的宽度?

时间:2015-07-22 05:23:29

标签: android xml listview popupmenu

我已经在列表视图的每个项目上实现了弹出菜单,问题是当我点击打开弹出菜单的图像视图时。弹出菜单的宽度太大。

我需要减小弹出菜单的宽度。截至目前,我已经减少了高度,文字大小,文字颜色,分隔符尺寸和尺寸。颜色和背景颜色。

通过修改style.xml中的以下更改(v-14& v-11的values文件夹):

<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>

0 个答案:

没有答案