how to set onClickListener on words of string in a textField in compose UI

210 views Asked by At

Actually I'm developing an social-media app where I want that my user can mention more than one user in between of their compliment string just like in Instagram comment section... on which if someOne tap of their username... it'll lead them to the particular user's profile desired result example

I'm well aware of the use of buildAnnotationString{} where we can play with textStyle but is there anyway to set onClickListener

1

There are 1 answers

0
Yasir Khan On

you have to create ClickableText not simple Text.

ClickableText(text = AnnotatedString("ClickableText"),
        onClick = {
           // perform here your action
        },
    )