Skip to content Skip to sidebar Skip to footer

Set Two Layouts For One Activity

I was wondering how I could show 2 different layouts within one activity. I have a multiplayer game right now that waits for opponenets to be found and what I want to have is to h

Solution 1:

I wouldn't play with the setContentView , it's too heavy for this simple operation. Just use a the "waiting" view on top of your wanted view, and play with the setVisibilty Visible/Gone.

If you find yourself in need of 2 setContentView you probably need 2 activities / fragments

Solution 2:

You can also simply use View.Gone and View.visible. just put the loading view on top. use View.visible on the loading view and View.Gone on the root of the other views. than, when the loading or waiting is done simply do View.Gone on the loading view and View.Visible on the rest.

Post a Comment for "Set Two Layouts For One Activity"