I have a list of web address display in a ListView
. Each item of ListView
have a TextView
and an ImageView
. TextView
have attribute autolink="web"
.
I also have event: onItemLongClick
in this ListView
to open details of each others. But when I do long click event on each item in list, they do open new page also open browser with link website in TextView
.
How can I set when onItemLongClick
, the TextView
can't click into link? I try set TextView.setLinkClickable(false)
but it isn't working.
Many thanks
You can achieve what you want in this way.
on your .xml, add this to the TextView
:
TextView ... android:autoLink="web" android:textIsSelectable="true"
on your code use ListView
click behavior and longClick behavior.
In your onItemLongClick()
method, return true
to indicate that you have consumed the click event and it should not be passed on to any other listeners.
According to the docs, the return value is described as -
boolean true if the callback consumed the long click, false otherwise
Returning true will NOT pass the long click event, which is also a click event, to the OnItemClickListener
.
U can try Using :-
Linkify.addLinks(txtView, Linkify.ALL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With