Disposing of controls in a layout at runtime on android application

不打扰是莪最后的温柔 提交于 2019-12-08 11:36:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!