.xml で
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
.java で
Button button1 = (Button)findViewById(R.id.button1);
button2.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linearLayout);
EditText editTextView = new EditText(MainActivity.this);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1);
editTextView.setLayoutParams(params);
linearLayout.addView(editTextView);
}});