![]() ![]() Now just for a moment think what all code you would have to write if you were using a RecyclerView, I bet most of us can’t even write the entire RecyclerView and ViewHolder logic without Googling. You can probably use it in the future to create a list in Jetpack Compose. In Google I/O’19, a component called ScrollingList was used in the demo but it is not yet available. Īlthough this is how you create a list in Jetpack Compose but VerticalScroller feels like a ScrollView in my opinion. ![]() ![]() If you need a horizontal list, you just need to replace VerticalScroller with a HorizontalScroller and Column with a Row. Then we use Kotlin’s forEach operator to loop through the list and add a Text component for each item in the list. We are using a Column inside VerticalScroller which works just like a LinearLayout with the vertical orientation. The above code snippet can be used in a situation where we are getting a list of data from a remote source or from the database and then we are displaying it inside the VerticalScroller. We need to use the Composable annotation for all composable functions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |