Reputation: 2579
I have a custom listview which contains among other things a textview with a website in it. I have autoLink in the XML set to true so the link works fine and when tapped the browser opens however tapping the list item doesn't open the activity it is meant to open.
Is there a way to get this to function correctly?
Upvotes: 2
Views: 1273
Reputation: 6813
Try using
android:focusable="false"
android:focusableInTouchMode="false"
As attributes of your TextView. Although i haven't figure out why the selection background does not appear with linkify it does make that trick of calling the browser when link is tapped.
Upvotes: 2
Reputation: 13801
Short Answer
I have experienced this problem before as well. The way I fixed this problem was by setting the text view's focusable property to false.
Longer answer
Basically the problem is that once a link is present, android resets the movement method on the TextView. This causes the focusabile property to be changed, and you can't have the text view be focusable if you want to be able to click on the list view item. Note, I had to call setFocusable programmatically instead of in the XML, but I was doing custom linking. Not sure if you are doing the same.
Upvotes: 3