I was looking for a solution to this problem that seems pretty trivial. I have an ExpandableListView with various children, including a TextView. I would like the links to be detected in the TextView, so I tried using android:autoLink="web" as well as Linkify.addLinks(textView, Linkify.WEB_URLS);
Or create hyperlinks in TextView. The problem I encountered is that if there is a link in the TextView, the ExpandableListView element with the link will no longer expand when you touch any elements inside the element.
I added android:descendantFocusability="blocksDescendants" at the beginning of most layouts of the ExpandableListView element. This allows you to expand the element, but only when you touch any other child element inside the element. If I touch text without a hyperlink in a TextView with a link, onGroupExpand is never called. If I set android:linksClickable="false" , it will expand, as expected, the links are highlighted, but, obviously, the links will not be clickable and will do nothing.
I read this answer here, ExpandableListView centains, the link is not expanding , which states that it is impossible, however it does not seem true, since android:descendantFocusability="blocksDescendants" allows this, just without touching the text without a hyperlink. I read that this is a bug here, https://code.google.com/p/android/issues/detail?id=3414 , but it was rejected.
How can I make links clickable and also expand the element when touching any text that is not associated with TextView hyperlinks?
source share