Адаптер для RecyclerView с разметкой - PullRequest
0 голосов
/ 21 марта 2019

Существует следующая разметка xml.

Эта разметка будет отображаться в RecyclerView.Как сделать следующее:

  1. Показать эту разметку в RecyclerView.Какой адаптер нужно написать?
  2. Когда вы нажимаете кнопку «Добавить» в RecyclerView, добавляете новый элемент с этой разметкой.
  3. Когда вы нажимаете «Удалить», удалите этот элемент из RecyclerView

    <android.support.design.widget.TextInputLayout
        android:id="@+id/stepTextInputLayout"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColorHint="@color/colorAccent">
    
        <android.support.design.widget.TextInputEditText
            android:id="@+id/stepTextInputEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Step" />
    </android.support.design.widget.TextInputLayout>
    
    <LinearLayout
        android:id="@+id/stepImgsBlock"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:padding="5dp">
    
        <ImageView
            android:id="@+id/img1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:srcCompat="@mipmap/ic_launcher" />
    
        <ImageView
            android:id="@+id/img2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:srcCompat="@mipmap/ic_launcher" />
    
        <ImageView
            android:id="@+id/img3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:srcCompat="@mipmap/ic_launcher" />
    </LinearLayout>
    
    <Button
        android:id="@+id/btnDelete"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Delete" />
    

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...