I have a simple vertical LinearLayout in which there is a button on the top and a Listview below it.
What I want is that when the button is pressed, it hides (using View.GONE) and the empty space generated by it is filled by ListView.
But after all the efforts, I have not been able to implement it.
I tried invalidate() and onDraw(), I tried giving layout_weight=1 to the ListView, I tried forceLayout(), requestLayout() methods as well but none of them worked.
The strange thing is that if there is EditText or TextView or any other component instead of ListView, its working fine i.e. Edittext etc. go and grab the empty space generated by hiding the Button. But in case of ListView , its not happening.
This thing is perfectly working in my emulator
XML code