进入多选模式,选择了什么 [英] enter multi-choice mode with nothing selected

查看:255
本文介绍了进入多选模式,选择了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的UX要求一个按钮,启动多选择模式。这将做一个项目同样的事情,长期pressing,但就什么都没有最初选择。

our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.

我所看到的在code是,我不能进入多选模式模式,除非我有什么选择,如果我取消选择该项目,多选模式退出(上下文操作栏关闭)。

what i'm seeing in the code is that i cannot enter multi-choice mode mode unless i have something selected, and if i unselect that item, multi-choice mode exits (contextual action bar closes).

我也试过这其他应用程序(Gmail的),它的工作原理是一样的。

i've also tried this in other apps (gmail), and it works the same way.

有没有办法将在多选模式下,选择任何项目?
谢谢。

is there a way to be in multi-select mode, with no items selected? thanks.

推荐答案

这是非常哈克,但我已经通过有选择的项目,但使它看起来像它没有选择,通过将后台暂时透明的做到了这一点。当一个项目被随后由用户选择时,秘密选定的项目被取消和背景恢复正常。或者,如果它被选中(因而取消它)偷偷选择的​​项目,我重新选择,然后设置一个布尔值来阻止它再次发生。

It's very hacky, but I've done this by having an item selected, but making it look like it's not selected, by making the background temporarily transparent. When an item is then selected by the user, the secretly-selected item is deselected and the background restored to normal. Or, if it's the secretly-selected item which is selected (thus deselecting it), I reselect it, then set a boolean to stop it happening again.

我也不得不使用onItemCheckedStateChanged一个柜​​台,因为我是从回调中改变的秘密项目的选中状态,导致一个循环。

I also had to use a counter in onItemCheckedStateChanged, as I was changing the checked state of the secret item from within that callback, resulting in a loop.

大概是所有情况下并不是一个理想的解决方案,但我不认为有另一种方式在目前这样做,因为<一href=\"http://stackoverflow.com/questions/9637759/is-it-possible-to-extend-abslistview-to-make-new-listview-implementations\">AbsListView不能很容易地扩展。

Probably not an ideal solution for all cases, but I don't think there's another way to do it at the moment, since AbsListView can't easily be extended.

编辑:如果屏幕方向的变化,而所选项目的选定状态是隐藏的,它会突然显示为被选中,所以你必须确保保存的事实,它应该被隐藏,之后其恢复列表视图中创建。我不得不使用View post()方法,以保证恢复发生在ListView已经完成了配置更改后重绘其所有子项后。

if the screen orientation changes while the selected state of the selected item is hidden, it will suddenly be shown as being selected, so you have to make sure to save the fact that it should be hidden, and restore it after the listview is recreated. I had to use the View post() method to ensure the restoration happened after the listview had finished redrawing all its child items after the configuration change.

编辑:如果用户试图同时也有所谓未选择任何项目,开展行动的另一个潜在的问题是。至于应用程序知道那里的的选择,因此将开展行动关于该项目,除非你确定它没有一个项目。

another potential issue is if the user tries to carry out an action while there are supposedly no items selected. As far as the application knows there is an item selected so it will carry out the action on that item, unless you make sure it doesn't.

这篇关于进入多选模式,选择了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆