问题
I need to reset a layout or dispose some of the controls on that layout according to some certain cases. But I couldn't find a way to do so. Do you have an idea about how to do?
Thanks in advance.
回答1:
Maybe you can just the hide the components, e.g. findViewById(R.id.the_id_of_the_view_to_hide).setVisibility(View.GONE);
There are different parameters for the visibility. GONE hides the view and also frees up the space, the view used before, as if it was removed completely.
来源:https://stackoverflow.com/questions/9686671/disposing-of-controls-in-a-layout-at-runtime-on-android-application