3

How can i show the lazycolumn from below? by default it shows me the list from above

 LazyColumn(){ itemsIndexed(items = chat){ index, chat -> Column(modifier = Modifier.padding(top = 1.dp, start = 6.dp, bottom = 1.dp, end = 6.dp)) { if(chat.sender.equals(MyId)){ ItemRigth(chat) } else{ ItemLeft(chat) } } } } 

2 Answers 2

6

If you set the reverseLayout param to true, the items will appear from the bottom.

LazyColumn( reverseLayout= true, // << here modifier = Modifier.fillMaxSize() ) { .. } 
Sign up to request clarification or add additional context in comments.

4 Comments

or aleternatively kotlin's List provides a pretty nice List<T>.reversed() method which can be used in the ViewModel. (Just trying to complement your answer.) +1
with this approach, the List object sort order is reversed. The question is regarding order of the list items are drawn on the screen...
the property reverseLayout shows me error
Which error? Which jetpack compose version are you using? It's working for me on beta-02.
0

https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/package-summary#lazycolumn

Set the reverseLayout parameter to true.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.