安卓:创建一个快捷操作菜单 [英] Android: Create a Quick Action Menu
问题描述
我需要创建一些类型的快捷操作菜单的显示右侧每当用户点击按钮点击的项目(按钮)的。
I need to create some type of quick action menu that appears to the right side of the clicked item (button) whenever the user clicks the button.
下面是我想要实现的一个例子:
Here's an example of what I'm trying to achieve:
当用户点击Button1的我想要的子快捷操作菜单出现像它的显示的图像上方。 反正有Android中做到这一点原生?
When the user clicks button1 I want the "sub quick action menu" to appear like it's shown in the image above. Is there anyway to do this 'natively' in android?
我发现这个插件,但它仅可以显示从按钮的顶部或底部的菜单。 https://github.com/lorensiuswlt/NewQuickAction3D
I have found this plugin but it only allows you to show the menu from the top or bottom of the button. https://github.com/lorensiuswlt/NewQuickAction3D
推荐答案
由于tyczj说,你可以做到这一点有一个弹出菜单。这个想法是,在弹出菜单将膨胀自定义视图与所有元素,具有作为背景9补丁图像。
这里有一个博客帖子,说明如何要做到这一点。希望它会帮助你。
As tyczj said, you could achieve that with a PopupMenu. The idea is that the popup menu will inflate a custom view with all the elements, having as background a 9 patch image.
Here's a blog post that shows how to do that. Hope it will help you.
这篇关于安卓:创建一个快捷操作菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!