ListView项longClick [英] ListView item longClick

查看:170
本文介绍了ListView项longClick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListFragment,而我附加一些报头(除其他的东西一的WebView)和页脚。据我所知,Android的网页视图处理的onLongClick事件显示与复制/粘贴一个CAB /从剪贴板。这对我来说完全没有问题,但我的问题是,每当我早就点击的WebView内容,以显示CAB,这种观点(ListView控件的标头),自动滚动到它的底部。

I have a ListFragment, to which I attach some headers(a WebView among other stuff) and footers. I understand that Android handles the onLongClick event of WebViews to show a CAB with copy/paste to/from Clipboard. This is perfectly fine for me, but my problem is that whenever I long click on WebView's content, to show the CAB, this view (header of ListView), automatically scrolls to the bottom of it.

这好像它是一个ListView项longClick默认操作,所以我的问题是,我怎么能覆盖这个东西(自动滚动到longClicked项目的底部),不损坏其他的东西(例如像:如果我长的点击,这并不需要驾驶室复制/粘贴出现,比ListView中应该处理它,因为它已经这样做)的一个项目。我试图重写的ListView的onItemLongClick方法返回false(所以它会通过进一步的回归,但它不一定似乎做我想要它做什么,它创建了一个奇怪的错误)。

This seems like it is a default action for a ListView item longClick, so my question is, how can I override this thing (of autoscrolling to the bottom of the longClicked item), without damaging other stuff (like for example: if I long click on an item that doesn't need the CAB with copy/paste to appear, than ListView should handle it as it already does). I tried Overriding the onItemLongClick method of the ListView to return false (so it will pass the returning further, but it doesn't necessarily seem to do what I'd like it to do, and it creates a strange bug).

Basicly(我认为),如果该项目的用户点击长包含的WebView,我需要的longClick事件分派到的WebView,否则的ListView应该处理它。

Basicly (I think) if the item that user long clicks on contains a WebView, I need to dispatch the longClick event to the WebView, otherwise ListView should handle it.

LE:我测试了对具有悠久的WebView作为其标题(大于屏幕)一ListFragment的新鲜小样本,并且好像它不自动滚动到LongClick页眉上的WebView的底部。话虽这么说,我看不到我还能有什么创造这样的行动。任何想法将是非常美联社preciated,也许我真的mistakely俯瞰一些小东西。

LE: I tested out against a fresh small sample of a ListFragment with a long(larger than the screen) WebView as its header, and is seems like it doesn't autoscroll to the bottom of the Header on LongClick on WebView. That being said, I can't see what could I do to create such action. Any ideas would be much appreciated, maybe I`m mistakely overlooking some small thing.

推荐答案

我花了很长的时间才能确定是什么问题这个问题,但最后我成功地做到这一点。

It took me a very long while to determine what was the problem to this issue, but finally I managed to do it.

这很行:

requestWindowFeature(Window.FEATURE_NO_TITLE);

requestWindowFeature(Window.FEATURE_NO_TITLE);

在活动被搞乱一切。希望这能帮助别人就可以不赔这么多的时间。

in the Activity was messing up everything. Hope that this will help someone else to not lose so much time on it.

PS。它可与再现

<item name="android:windowNoTitle">true</item>

在XML了。

这篇关于ListView项longClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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