У меня есть recyclerView и два типа строк: одна с textView и переключателем для логического ответа, а другая с textView и editText для String.
У меня есть API, который имеет имя и тип, если это логическое значение или строка.
Как я могу создать разные строки с этими двумя типами, для которых я не знаю счетчик каждого из них, но у меня есть счетчик всех их.
row_critere_edit_text.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:layout_margin="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/textView_row_critere"/>
<EditText
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:gravity="center"
android:id="@+id/editText_critere_"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
row_critere_boolean.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:layout_margin="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/textView_row_critere_boolean"/>
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:gravity="center"
android:id="@+id/switch_critere_boolean"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
и у меня есть два массива
List<String> nameCritere = new ArrayList<>();
List<String> typeCritere = new ArrayList<>();