Android 安卓弹出菜单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3451889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:15:07  来源:igfitidea点击:

Android popup menu

androidmenupopupcontacts

提问by RailsSon

I am making an Android app. I have a list of items displaying. I am looking to create a popup menu just like the one that pops up when you tap the avatar of a contact in the contact list. I have tried looking through the Android reference but can not find it.

我正在制作一个Android应用程序。我有一个显示的项目列表。我希望创建一个弹出菜单,就像在您点击联系人列表中的联系人头像时弹出的菜单一样。我曾尝试查看 Android 参考,但找不到。

Has anyone created one of these popup menus? A link to the reference or a code sample is fine.

有没有人创建过这些弹出菜单之一?参考或代码示例的链接很好。

Screenshot of menu:

菜单截图:

http://www.youchoob.org/pics/popup.jpg

http://www.youchoob.org/pics/popup.jpg

回答by Aurora

What you are describing is called a 'Quick Action'. This is actually a user interface pattern - there isn't an existing widget or anything in the API for this. They discussed it at Google IO (See in this video here, at the 15:40 mark), and also there has been some discussion on how to implement it on stack overflow, specifically thisquestion. If you start digging around (now that you know the name of what you are looking for) you might find more.

您所描述的内容称为“快速操作”。这实际上是一个用户界面模式 - 没有现有的小部件或 API 中的任何东西。他们在 Google IO 上讨论了它(参见这里的视频,在 15:40 标记处),并且还讨论了如何在堆栈溢出时实现它,特别是这个问题。如果您开始四处寻找(现在您知道要查找的内容的名称),您可能会发现更多。

回答by Mike

The source code for the contacts is open source. You should look around here and see if you can find it.

联系人的源代码是开源的。你应该四处看看,看看你能不能找到它。

https://android.googlesource.com/platform/packages/apps/Contacts

https://android.googlesource.com/platform/packages/apps/Contacts

I'm looking now if I find it I will edit.

我现在正在寻找,如果我找到它,我将进行编辑。

回答by Bipin Vayalu