0

How to make a Text or TextField which will scroll its content automatically horizontally while content is longer than size in android jetpack compose? Like horizontal Marque

I know that I can use:

modifier = Modifier.fillMaxWidth(0.7f).horizontalScroll(rememberScrollState())

but it doesn't scroll automatically, I have to drag it.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Cipri
  • 57
  • 1
  • 9

1 Answers1

3

Starting from 1.4.0-alpha04 you can use the basicMarquee modifier:

// Marquee only animates when the content doesn't fit in the max width.

Column(Modifier.width(100.dp)) {
    Text("hello world hello world hello world",
        modifier = Modifier.basicMarquee())
}

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841