自定义的ListView不点击强调的ListViewItem [英] Custom ListView not highlighting ListViewItem on click

查看:188
本文介绍了自定义的ListView不点击强调的ListViewItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了一个ImageView的和一个TextView的自定义列表视图。点击工作正常,但它不会突出像一个正常的ListView会的项目。如何将添加一个亮点?我试图钻机它通过设置上点击背景颜色,然后加入一个计时器以去除背景色。这工作,但我希望有一个更好的解决方案。任何想法?

I have a custom listview made up of an ImageView and a TextView. Clicking works fine however it won't highlight the item like a normal ListView would. How would I add a highlight? I tried to rig it by setting the background color on click and then adding a timer to remove the background color. That worked but I want a better solution. Any ideas?

推荐答案

我想你可以尝试使用的 colorstate 。定义颜色STATE_ pressed,state_selected和任何其他适当的状态,然后将你的观点的colorstate的背景。

I think you can try to use the colorstate. Define the colors for state_pressed, state_selected and any other appropriate states, then set the background of your view to the colorstate.

这篇关于自定义的ListView不点击强调的ListViewItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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