Add & delete view from Layout


Question

How can I add & delete a view from a layout?

1
86
1/15/2014 10:04:06 PM

Accepted Answer

I've done it like so:

((ViewManager)entry.getParent()).removeView(entry);
203
7/11/2012 1:52:47 PM

Use ViewStub and specify the layout of the view you want to toggle. To view:

mViewStub.setVisibility(View.VISIBLE) or mViewStub.inflate();

To disappear:

mViewStub.setVisibility(View.GONE);

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon