I want to create a scrollable Text in Jetpack Compose.
In View system, we can make text scrollable by using:
android:scrollbars = "vertical" and
textview.setMovementMethod(new ScrollingMovementMethod());
Please help me!
I tried using Modifier.verticalScroll(rememberScrollState()) but it doesn't work
My Solution might be late for you yet I post it here, it might help others :)
I had the same problem and solved it by wrapping my scrollable Text Component into a LazyColumn. But beware! Your content must be big enough, in my case I had a fixed height, which may result in text overflow
val scroll = rememberScrollState(0)
LazyColumn( modifier = ...) {
item {
Text(
text = "YourText",
modifier = Modifier
.padding(...)
.height(90.dp)
.verticalScroll(scroll)
)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With