File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/text Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -550,17 +550,29 @@ private object TextEffectiveStateManagement2 {
550550// [START android_compose_text_link_1]
551551@Composable
552552fun AnnotatedStringWithLinkSample () {
553- // Display a link in the text
553+ // Display multiple links in the text
554554 Text (
555555 buildAnnotatedString {
556- append(" Build better apps faster with " )
556+ append(" Go to the " )
557557 withLink(
558558 LinkAnnotation .Url (
559559 " https://developer.android.com/jetpack/compose" ,
560560 TextLinkStyles (style = SpanStyle (color = Color .Blue ))
561561 )
562562 ) {
563- append(" Jetpack Compose" )
563+ append(" Android Developers " )
564+ pop()
565+ append(" website, and check out the" )
566+ }
567+ withLink(
568+ LinkAnnotation .Url (
569+ " https://developer.android.com/jetpack/compose" ,
570+ TextLinkStyles (style = SpanStyle (color = Color .Green ))
571+ )
572+ ) {
573+ append(" Compose guidance" )
574+ pop()
575+ append(" ." )
564576 }
565577 }
566578 )
You can’t perform that action at this time.
0 commit comments