I have a Text
object in Jetpack Compose whose content is continuously getting longer, but I only want to render the last 3 lines at any given time. Essentially, I'm hoping to mimic the behavior of TextView
's android:gravity="bottom"
, as seen here . How would I go about achieving this?
You can use maxLines in your Text function to render 3 Line and the gravity you can use align instead keep in mind you only allowed use align inside LayoutScope like Row Column Box etc. you can try thi code
Row(modifier = Modifier.fillMaxSize()) {
Text(
text = "some text .....",
modifier = Modifier.align(Alignment.Bottom),
maxLines = 3
)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.