android - 编辑 Activity 的上下文操作栏

标签 android contextual-action-bar

我对上下文操作栏的概念有疑问。 Android 设计指南建议在用户选择 Activity 中的内容时使用 CAB 以向他提供一些操作。

正如在“People”(/“Contacts”?)应用程序中实现的那样,编辑数据也很有意义。 例如,我希望用户单击一个列表项,将他带到一个详细信息 Activity 。在详细信息 Activity 中,您可以按下将您带到编辑 Activity 的编辑操作项。在此编辑 Activity 中,我想显示 CAB 以允许通过按 DONE 按钮或 BACK 按钮进行保存或通过菜单项取消。

CAB 是否打算以这种方式使用?它在 People 应用程序中是这样实现的,所以我认为是的。

我当前的实现在 Activity 创建时启动操作模式。这有点不酷,因为当按下 DONE 时,我启动了一个 AsyncTask 以将数据保存在服务器上,这需要时间,但 CAB 立即消失,然后显示默认操作栏。有没有更好的方法来使用 CAB,使其在 Activity 之前不被销毁?

PS: 使用 ActionBarSherlock

最佳答案

Is the CAB intended to be used in this way? It´s implemented in the People app like this, so I think yes.

这不一定是一种 Action 模式。在 Roman Nurik's "DONE + DISCARD" sample ,它是一个自定义操作栏。

关于android - 编辑 Activity 的上下文操作栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12819677/

相关文章:

android - Activity Bundle ,什么时候会丢失?

android - 如何在上下文操作栏中检索 ListView 选定项

android - ListView CAB勾选项着色

android - 菜单项的上下文操作栏奇怪行为

android - 如何在上下文操作栏中创建 "Search"字段?

android - Admob 广告在应用程序中显示,但在 admob 界面上没有展示

android - 为 Firebase 生成 PDF 缩略图

安卓工作室 : How to create quick clones or copies of current project

android - PixlUI 无法在 android 中获取字体

android - 上下文操作栏的兼容性