Thursday, March 15, 2012

How to remove view from layout in android dynamically



Android remove view from parent


View myView = findViewById(R.id.hiddenLayout);
ViewGroup parent = (ViewGroup) myView.getParent();
parent.removeView(myView);

Android remove all child views


LinearLayout formLayout = (LinearLayout)findViewById(R.id.formLayout);
formLayout.removeAllViews();

No comments:

Post a Comment