LazyList Padding in Jetpack Compose
In Jetpack Compose, while using LazyLists like LazyColumn
or LazyRow
. We may need to specify padding for various designs.
Padding for each item in the layout
We use Modifier
in each item
composable to specify padding for each individual item (lines 11–13).
Padding for the whole layout
Padding for the layout is achieved using Modifier
on the LazyRow
/ LazyColumn
(line 6).
In this, we can see that the padding at top and bottom will not change when we scroll the list.
But, in some cases we may need the padding to be shown only when we scroll to the bottom or stay at the top. The padding when the list is scrolled might not be the expected UI.
Padding for content
Padding only for content can be achieved like this using contentPadding
parameter.
Please comment with your valuable feedback. It would help me to improvise.
Kindly 👏👏👏 if this was useful.
Please follow if you would like to see more content related to Android Jetpack Compose.
LinkedIn: https://www.linkedin.com/in/abhimanyu-n/