在一个ListView的“永久性”选择建议 [英] Recommendations for a 'permanent' Selector in ListView

查看:117
本文介绍了在一个ListView的“永久性”选择建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要找的建议,关于如何去增加一个的ListView 选择是永久性。这里,我指的是在的ListView 总是强调了单行;它应该或向下效应初探向上移动到任何D垫presses(即喜欢默认的选择),但也仍然设置/高亮如果用户是滚动的ListView 在任一方向(即它仍然强调,即使它关闭屏幕)。

我看了使用标准选择机制,但我无法得到选择留在原地。如果被触摸的ListView (和滚动),所以这让我觉得,这是不是最好的选择?也许有一个<选择> 状态_ * 我已经忽略了

另一种选择是使用 onItemSelected()的回调,但是先来看看这似乎比较绕口?

任何建议/建议/经验感激receieved。

干杯

詹姆斯


解决方案

  

我正在寻找关于如何去增加一个ListView选择是永久性的建议。


请不要这样做。有一个在触摸模式下没有选择,这是由设计。如这篇文章建议,如果你需要持续使用相应的功能选择(单选按钮,复选框,ListView的选择模式等)。不要试图保持联系方式的焦点或选择范围。

I'm looking for suggestions on how to go about adding a ListView selector that is 'permanent'. By this, I mean a single row in the ListView is always highlighted; it should move up or down in reponse to any D-pad presses (i.e. like the default selector) but also remain set/highlighted if the user were to scroll the ListView in either direction (i.e. it's still highlighted even when it's off-screen).

I've looked at using the standard selector mechanism, but am unable to get the selector to remain in place if the ListView is touched (and thus scrolled), so it makes me think that this isn't the best option? Perhaps there's a <selector> "state_*" that I've ignored?

The other option would be to use the onItemSelected() callback, but at first look this appears more convoluted?

Any suggestions/recommendations/experiences gratefully receieved.

Cheers

James

解决方案

I'm looking for suggestions on how to go about adding a ListView selector that is 'permanent'.

Please do not do this. There is no selection in touch mode, and that is by design. As suggested in this article, "Use the appropriate feature if you need persistent selection (radio button, check box, the ListView choice mode, etc.). Do not try to keep the focus or selection in touch mode."

这篇关于在一个ListView的“永久性”选择建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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