I have many different items on my main.xml layout (30+). I have to constantly throughout an activity I have to use…
tv1.setVisibility(View.GONE);
tv2.setVisibility(View.GONE);
…for at least 20 of the items. I think it would be easier if some how you could make it so, instead of View.GONE, you can choose what items to show and hide the rest.
tv3.setVisibility(View.SHOW);
tv4.setVisibility(View.GONE);
// Some code to hide the rest
Is there anything I can do to make this similar, or maybe some code that just hides the rest?
Instead of putting everything into one layout and changing the visibility, is it possible you could make multiple layouts and switch between them? that becomes just one line to switch, and a few more to initialize the settings for the components.