ListView控件的更改默认onListItemClick行为 [英] Change default onListItemClick Behavior of ListView

查看:240
本文介绍了ListView控件的更改默认onListItemClick行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法可以让我的listactivity(而列表视图)突出显示列表项被点击时( pressed 的)时? (...并保持高亮) 默认的行为,只是凸显了片刻的项目,并逐渐变黑......

Is there any way i can make my listactivity (rather listview) highlight the List Item when it is clicked (pressed) upon? (...and remain highlighted) The default behavior, simply highlights the item for a moment, and it gradually fades to black...

目前,当我们使用DPAD只有突出发生...

Currently, the highlighting only happens when we use the DPad...

这将会是理想的,如果用于至少一个列表项强调在任何时候。

It'd be ideal if atleast one list item is "highlighted" at all times.

最坏的情况,我可能要跟踪的最后单击项目的(默认的第一个),并改变它的背景什么的......但我希望有一个更简单的方法...

Worst case scenario, i may have to keep track of the "last clicked item" (by default the first) and change its background or something...but i was hoping there was an easier way...

在此先感谢! :)

推荐答案

这是不是在Android上一个优秀的用户界面的做法;项目不应该成为焦点,也似乎有重点,触摸。您可能需要使用无线电盒,而不是列表中的项目。可能还有其他,prettier解决方案,以及—我很乐意进行头脑风暴,如果你讨论你的使用情况。

That isn't a good UI practice on Android; items should not be focusable, nor appear to have focus, on touch. You may want to use list items with radio boxes instead. There may be other, prettier solutions as well — I'd be happy to brainstorm if you discussed your use case.

更新:(前锋/答复的/ etc上的消息上下文动作)在新的环境中您的评论,这里有一些其他的选项:

Update: Given the new context in your comment (forward/reply/etc. contextual actions on messages), here are some other options:

  1. 使用标准的上下文菜单,通过长期pressing对列表项触发。
  2. 使用新的快速动作的[1]的模式在推特见过的Andr​​oid应用程序。
  1. Use standard context menus, triggered by long-pressing on list items.
  2. Use the new Quick Actions [1] pattern as seen in the Twitter for Android app.

在这两种情况下,你可以使用屏幕上的启示为造就上下文动作,类似于Twitter的应用程序的每个鸣叫内循环更多按钮。如果您想了解更多可发现性。

In either case, you can use an on-screen affordance for bringing up contextual actions, similar to the circular 'more' button inside each tweet in the Twitter app. if you'd like more discoverability.

现在,如果你打算支持多项目上下文动作,另一种选择是使用Gmail使用复选框+滑动式操作面板的用户界面模式。

Now, if you plan to support multi-item contextual actions, another option is to use the checkbox + slide-up action-panel UI pattern that Gmail uses.

[1]的连结操作的用户界面模式,如在 Android的UI设计模式会议在谷歌I / O 2010(见幻灯片16中的<一个href="https://docs.google.com/viewer?url=http://dl.google.com/googleio/2010/android-android-ui-design-patterns.pdf"相对=nofollow>会议幻灯片平台)。需要注意的是,虽然快速操作code不是在Android SDK的那一刻,微博为Android将开源因此code可以在你的应用程序中使用。

[1] Quick Actions UI pattern, as discussed in the Android UI design patterns session at Google I/O 2010 (see slide 16 in the session slide deck). Note that although the Quick Actions code isn't in the Android SDK at the moment, Twitter for Android will be open-sourced so the code could be used in your apps.

这篇关于ListView控件的更改默认onListItemClick行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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