I have a horizontal LinearLayout with 4 child LinearLayouts, each having a weight of 1. With all of the 4 children visible, the screen is nicely divided in a 25% ratio for all 4. But when I change the visibility of 1 child to gone (statically, in the XML), the layout still takes space (as if invisible) and the other 3 layouts keep on sharing 25% each; rather than 33% each.
I have ensured proper weights, with layout_height of 0dp. I also tried setting visibility to gone for all the children of the LinearLayout I want to hide.
What other things can I try ?
Silly mistake ! I had set the layout_width of parent LinearLayout as wrap_content. Changing it to match_parent worked :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With