[英]How do I start a lazyRow in the last index on Jetpack Compose?
[英]How do I show only the last 3 lines of text in Jetpack Compose?
我在 Jetpack Compose 中有一個Text
對象,其內容不斷變長,但我只想在任何給定時間渲染最后 3 行。 從本質上講,我希望模仿的行為TextView
的android:gravity="bottom"
,因為看到這里。 我將如何實現這一目標?
您可以在 Text 函數中使用 maxLines 來渲染 3 行,並且可以使用 align 代替重力,請記住,您只允許在 LayoutScope 內使用 align ,例如 Row Column Box 等。您可以嘗試此代碼
Row(modifier = Modifier.fillMaxSize()) {
Text(
text = "some text .....",
modifier = Modifier.align(Alignment.Bottom),
maxLines = 3
)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.