-
Notifications
You must be signed in to change notification settings - Fork 12
Create Layouts in XML and add Views at run time(in Java)
rutura edited this page Apr 16, 2017
·
1 revision
- Quick Code:
LinearLayout layout = (LinearLayout)getLayoutInflater()
.inflate(R.layout.activity_main, null);
//Add a new button.Here you can also add complex ui structures
Button reset = new Button(this);
reset.setText("Reset Form");
layout.addView(reset,
new LinearLayout.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT,
ActionBar.LayoutParams.WRAP_CONTENT));