How to make a Text which will scroll its content horizontally while content is longer than size in android jetpack compose?

Viewed 3438

Honestly, I don't have any code about it.

Besides using 3rd party sdk or dive in using canvas, I can't think of any other idea.

Just a hint will be better than nothing...

It should behavior like a Marquee.

1 Answers

To create and automatically remember ScrollState with default parameters use rememberScrollState.

val scroll = rememberScrollState(0)

You can add the horizontalScroll modifier to enable scrolling within the Text.

Text(
            text = "some long text"
            modifier = Modifier.horizontalScroll(scroll)
        ) 

For more read

Related