ListView item longClick


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.

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 (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: 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.

this very line:


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

PS. It can be reproduced with

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

in xml too.

Answered By – DoruAdryan

Leave a Comment