I have 3 layouts, I need when click on button access certain layout and ad remove controls from and in it any idea how to achieve that , this is the code I use
Add andoird:id="@+id/linerlayout_1"
after that you can access this view easy inside the code with the findviewbyid()
method.
For examlpe: place this inside the button's onclicklistener method.
LinearLayout ll = (LinearLayout) findViewById(R.id.linerlayout);
ll.setVisibility(View.GONE); // this row will hide the entire linerlayout
ll.addView(someView); //this row will add the specified View f.e.: TextView
ll.removeView(otherView); // this row will remove the view
And you can manage th view visibility by xml attribute android:visibility
too.