创建浮动弹出列表

时间:2012-08-09 12:31:07

标签: android list popup

我想创建一个弹出窗口,如下面给出的链接。我以为它会使用QuickContactBabage,但事实并非如此。并且不打算如何创建它。

image link http://cdn3.staztic.com/screenshots/android-swim-32-2.jpg

提前致谢

1 个答案:

答案 0 :(得分:5)

通过扩展PopupWindow,您可以按照您的要求做任何您需要的事情。下面是popwindow显示过程的主要代码。

ActionItem nextItem     = new ActionItem(ID_DOWN, "Next", getResources().getDrawable(R.drawable.menu_down_arrow));
ActionItem prevItem     = new ActionItem(ID_UP, "Prev", getResources().getDrawable(R.drawable.menu_up_arrow));
ActionItem searchItem   = new ActionItem(ID_SEARCH, "Find", getResources().getDrawable(R.drawable.menu_search));
ActionItem infoItem     = new ActionItem(ID_INFO, "Info", getResources().getDrawable(R.drawable.menu_info));
ActionItem eraseItem    = new ActionItem(ID_ERASE, "Clear", getResources().getDrawable(R.drawable.menu_eraser));
ActionItem okItem       = new ActionItem(ID_OK, "OK", getResources().getDrawable(R.drawable.menu_ok));

//use setSticky(true) to disable QuickAction dialog being dismissed after an item is clicked
prevItem.setSticky(true);
nextItem.setSticky(true);

//create QuickAction. Use QuickAction.VERTICAL or QuickAction.HORIZONTAL param to define layout 
//orientation
final QuickAction quickAction = new QuickAction(this, QuickAction.VERTICAL);

//add action items into QuickAction
quickAction.addActionItem(nextItem);
quickAction.addActionItem(prevItem);
quickAction.addActionItem(searchItem);
quickAction.addActionItem(infoItem);
quickAction.addActionItem(eraseItem);
quickAction.addActionItem(okItem);

通过尝试NewQuickAction3D示例,您将获得如下输出 -

image

另外,请看这里QuickAction Dialog in Android