-1
Поскольку у нас возникают проблемы при циклическом цикле динамических представлений ниже, поэтому просим вас взглянуть в то же самое и сообщить нам о любом хорошем и надежном решении для того же самого, что может действительно помочь мне.Для Loop для дополнительного представления в макете
layout.xml
<RelativeLayout
android:id="@+id/ll2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll"
>
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Meda name"
android:textColor="#000"
android:textColorHint="#000" />
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="1"
android:layout_toRightOf="@+id/editText2"
android:textColor="#000"
android:textColorHint="#000" />
<EditText
android:id="@+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="tick"
android:layout_toRightOf="@+id/editText3"
android:textColor="#000"
android:textColorHint="#000" />
<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="tick"
android:layout_toRightOf="@+id/editText4"
android:textColor="#000"
android:textColorHint="#000" />
</RelativeLayout>
Code.java
for (int i = 0; i < 4; i++) {
RelativeLayoutll2 = (RelativeLayout) findViewById(R.id.ll2);
EditText testname = new EditText(getApplicationContext());
testname.setText("Med");
testname.setTextColor(000);
EditText testname1 = new EditText(getApplicationContext());
testname.setText("Hello");
testname.setTextColor(000);
EditText testname3 = new EditText(getApplicationContext());
testname.setText("Hello");
testname.setTextColor(000);
EditText testname2 = new EditText(getApplicationContext());
testname.setText("Hello");
testname.setTextColor(000);
ll2.addView(testname);
ll2.addView(testname1);
ll2.addView(testname3);
ll2.addView(testname2);
}
Пожалуйста, обратитесь это изображение. Я хочу быть таким, когда я выбираю номер в Spinner
, где он должен отображать это количество полей.
почему не вы используете ListView – Gaurav
я сделал это динамически сэр я хочу попробовать по-другому то будет у поблагодарить у – prominere
хорошо. хорошо сделано просто отправьте свой ответ, затем – Gaurav