androidandroid-studiokotlinandroid-jetpack-composeandroid-jetpack-compose-list

I want to achieve the below layout, the button should be at the bottom of the screen, when the lazy column is filled, the button shouldn't go outside


There is lazy column at top and below the lazy column there is enter phone number layout and add contact from phonebook layout, I want this layout to be at top when no contact is added and when I add lots of contact the enter phone number and add contact from phonebook layout scrolls along with the lazy column and goes outside of the screen. I don't them to go outside of the screen. They must stick to bottom when there is lots of contact.

enter image description here


Solution

  • You can apply the weight modifier to the LazyColumn.
    Something like:

    Column(){
    
        LazyColumn(Modifier.weight(weight = 1f, fill = false)) {
            //....
        }
    
        Footer()
    }
    

    Using fill=false the element will not occupy the whole width allocated.

    enter image description here