How do I remove a View from its superview? In iOS it's performed by sending removeFromSuperview
to the view that should be removed.
You can use getParent()
to get the parent of the View
, then call removeView()
on it.
View yourView = ...;
ViewGroup viewParent = (ViewGroup) yourView.getParent();
viewParent.removeView(yourView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With