kotlin - Clickable string for Links in compose, should not block click on listItems - Stack Overflow

admin2025-05-01  0

Want I want is to create an annotated string that can contain links and deeplinks <a href="..."> ... </a> and can be used for text throughout the whole app.

Text comes from a backend.

My problem specifically lies in the use of this text on listItems. What i was able to create so far works but the text on listItems blocks the click. So when i click on the text of a list item i can't trigger the listItem's onClick.

A click should only be consumed by that part of the text that is a link. The rest of the text should not consume the click at all.

I followed this aritcle but part of the code seems to no longer work:

/@graser1305/creating-interactive-html-content-in-jetpack-compose-7f7e929152f3

This is the part i am talking about:

addLink(
        url = LinkAnnotation.Url(
            url = url,
            linkInteractionListener = {
                uriHandler.openUri(url)
            }
        ),
        start = start,
        end = end
    )

so instead of this i use getAnnotatedString()

any help would be much appreciated!

Best regards

转载请注明原文地址:http://anycun.com/QandA/1746096216a91611.html