ListView Click和LongClick [英] ListView Click and LongClick
问题描述
我有一个带有ItemClickListener和ItemLongClickListener的ListView。单击某个项目时,它将启动一个新活动。当您长按一个项目时,它会将该行中隐藏文本视图的可见性设置为可见。
I have a ListView with an ItemClickListener and an ItemLongClickListener. When you click an item, it starts a new activity. When you long click an item, it sets the visibility of a hidden textview in that row to visible.
当您长按时,隐藏的文本视图变为可见,但是当您释放点击它开始新活动,这是我不想要的。
When you long click, the hidden textview becomes visible, but when you release the click it starts the new activity, which I don't want.
我如何兼顾两个听众?此外,我正在考虑长时间点击以使隐藏的textview在所有行中可见(使用LongClickListener而不是ItemLongClickListener),而不仅仅是单击的那个,但我甚至无法让它甚至识别longclick。
How do I go about having both listeners? Also, I'm considering on a long click to make the hidden textview visible in all rows (using LongClickListener instead of ItemLongClickListener), not just the clicked one but I'm unable to get it to even recognize a longclick then.
推荐答案
返回 true
以表示事件已被处理。
Return true
to signalize that the event has been handled.
这篇关于ListView Click和LongClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!