简体   繁体   English

Android:如何执行此弹出菜单(旋转器或其他功能?)

[英]Android: How can I do this popup menu (spinner or something else?)

在此处输入图片说明

I don't understand. 我不明白 Is it spinner, popup or clickabel custom layout? 它是微调器,弹出窗口还是clickabel自定义布局? I tried to make spinner. 我试图做微调器。 Created the adapter with getView and getDropDownView, but I don't understand how to make margins before the first element and after last. 用getView和getDropDownView创建了适配器,但我不明白如何在第一个元素之前和最后一个元素之后添加边距。 Also it isn't clear how insert in the middle a divider that the clickabel area of items also had an margin from a divider. 同样还不清楚如何在分隔符的中间插入项目的clickabel区域也有分隔符的空白。 As in the drawing. 如图所示。 Gray items - pressed. 灰色项目-已按下。 Also i have tried custom spinner style 我也尝试过自定义微调器样式

<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>

spaces from above and from below have appeared, but it seems to me, it is wrong. 上面和下面都出现了空格,但在我看来,这是错误的。

If you need something like Spinner with more options you can use ListPopupWindow which you can customize by extending a adapter with multiple types of items/xml. 如果您需要诸如Spinner之类的带有更多选项的东西,则可以使用ListPopupWindow ,您可以通过扩展具有多种项目/ xml类型的适配器进行自定义。

Or just create PopupWindow looks like you want and show it as drop down . 或者只是创建想要的PopupWindow并将其显示为下拉菜单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM