What is the modal selection selection mode?(什么是模态选择选择模式?)
问题描述
当我将 ListView
的选择模式设置为多个时,我遇到了 Android API 级别 11 中引入的这个常量:CHOICE_MODE_MULTIPLE_MODAL.JavaDoc 对我帮助不大:
When setting the selection mode of my ListView
to multiple, I came across this constant introduced in Android API level 11: CHOICE_MODE_MULTIPLE_MODAL. The JavaDoc didn't help me out much:
public static final int CHOICE_MODE_MULTIPLE_MODAL
public static final int CHOICE_MODE_MULTIPLE_MODAL
列表允许在模态选择模式下进行多项选择.
The list allows multiple choices in a modal selection mode.
什么是模态选择模式?到处都找不到.
What is a modal selection mode? Can't find it nowheres.
推荐答案
这用于在使用操作栏时调出操作模式(也称为上下文操作栏).您将在 Gmail 等应用程序中看到它:当您开始检查列表中的项目时,操作栏会从通用活动级别操作更改为要在列表上执行的操作(例如,更改标签、垃圾箱).
This is used to bring up an action mode (a.k.a., contextual action bar) when using action bars. You will see it in apps like Gmail: as you start checking items in the list, the action bar changes from generic activity-level actions to operations to be performed on the list (e.g., change labels, trash).
像 CHOICE_MODE_MULTIPLE
一样,您需要 ListView
由 Checkable
项填充.但是,一旦选中一项或多项,Android 会自动弹出您选择的操作模式,您可以使用自己的操作进行配置.
Like CHOICE_MODE_MULTIPLE
, you need your ListView
to be populated by Checkable
items. Then, though, once one or more items are checked, Android will automatically pop up your chosen action mode, which you can configure with your own actions.
这里是一个示例项目,演示了这一点:https://github.com/commonsguy/cw-omnibus/tree/master/ActionMode/ActionModeMC
Here is a sample project that demonstrates this: https://github.com/commonsguy/cw-omnibus/tree/master/ActionMode/ActionModeMC
这篇关于什么是模态选择选择模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!