Android 快速操作 UI 模式

我对合并名为“快速行动”的 Android 用户界面模式感兴趣。基本上,它是一个上下文菜单,不会掩盖正在执行的数据。我想实现这一点,但我无法找到一些示例代码或 API 来帮助我。

注意,这个 UI 模式在 YouTube 视频 http://www.youtube.com/watch?v=M1ZBjlCRfz0#t=15m20s中进行了讨论。

是否有人实现了这个功能,或者知道 Google 将这个功能添加到应用程序的标准是什么?

55463 次浏览

Interesting Question. Android uses this pattern in their Contacts-App. You can get the source using git:

git clone git://android.git.kernel.org/platform/packages/apps/Contacts.git

I did this and quickly grepped it, but I didn't get a conclusive result. I think that's done in "Contacts/src/com/android/contacts/ui/QuickContactWindow.java", but I am not completely sure.

I you google for QuickContact android, there are a lot of images that show exactly the kind of menu that you want, so it seems likely that it is indeed called QuickContact in that context.

Looking at the Documentation, I don't see any inherited classes that you could use to do this for something other than contacts.

So, a few starting points, but no solution from me ;-)

Till the official Twitter app is open sourced by Google, you may want to take a look at this implementation: http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/

Really easy to use and works great.

This open source project has the same look and feel for the quick actions popup as the twitter app:

http://github.com/ruqqq/WorldHeritageSite/tree/master/src/sg/ruqqq/WHSFinder

It helps to download the whole project because you need a number of drawables, images, and other resources from that project.

The main demo class is called WHSListActivity.java. The other classes you need is QuickActionWindow.java, and QuickActionItem.java.

After that, it's really easy and works great. I use it for my apps.