Reputation: 2436
I would like to make a LinearLayout that was created from xml invisible, and another LinearLayout visible to replace it. The replacement layout starts out as invisible. When I make the originally visible layout invisible, it still leaves space for it on the screen. How can I refresh the screen so that space is gone?
Upvotes: 2
Views: 2142
Reputation: 13062
I have done this before and its actually very simple. Make 2 different layout xml files, one for each layout you want to show. When you want to switch from one to the other, all you have to do is call setContentView(R.layout.some_layout)
and you're done!
pretty easy eh?
Upvotes: 0
Reputation: 420951
Perhaps you are mixing up View.INVISIBLE
with View.GONE
:
int GONE
This view is invisible, and it doesn't take any space for layout purposes.
int INVISIBLE
This view is invisible, but it still takes up space for layout purposes.
Upvotes: 4