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
Sample for dynamically add or remove a view:
TextView tv = new TextView(this);
tv.setWidth(LayoutParams.WRAP_CONTENT);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.RIGHT;
tv.setLayoutParams(params);
tv.setTextAppearance(this, R.style.darkTextNormal);
tv.setBackgroundResource(R.color.lightBlue);
tv.setTextSize(16);
yourLinearLayout.addView(tv);
// or
yourLinearLayout.removeView(tv);