高度未显示在Android的PopupMenu中

时间:2019-01-23 13:53:12

标签: android menu android-5.0-lollipop popupmenu

海拔在PopupMenu中不起作用。我尝试使用styles.xml实现PopupMenu的海拔,但无法正常工作。我想为PopupMenu Screenshot for an issue

实现阴影

在代码中实现的弹出菜单

 Context wrapper = new ContextThemeWrapper(this, R.style.MyPopupMenu);
                   PopupMenu popup = new PopupMenu(wrapper, vItem);
                    MenuInflater inflater = popup.getMenuInflater();
                    popup.setOnMenuItemClickListener(TaskDetailActivity.this);
                    inflater.inflate(R.menu.overflow_menu, popup.getMenu());
                    popup.show();

Styles.xml

    <style name="MyPopupMenu" parent="@style/Widget.AppCompat.PopupMenu">
            <item name="android:itemBackground">@color/md_white_1000</item>
            <item name="android:clipToPadding">false</item>
            <item name="android:popupElevation" 
           tools:targetApi="lollipop">@dimen/_20sdp</item> </style>

0 个答案:

没有答案