Newer
Older
DevRealm / app / src / main / res / layout / list_item.xml
MatsumotoKeiju on 8 Nov 2017 2 KB [add] Custom RecyclerView Adapter
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="itemViewModel"
            type="jackall.devrealm.viewmodel.ItemViewModel" />
    </data>

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="8dp">

        <TextView
            android:id="@+id/list_item_last_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{itemViewModel.lastName}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/list_item_first_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{itemViewModel.firstName}"
            app:layout_constraintBottom_toBottomOf="@id/list_item_last_name"
            app:layout_constraintStart_toEndOf="@id/list_item_last_name"
            app:layout_constraintTop_toTopOf="@id/list_item_last_name" />

        <TextView
            android:id="@+id/list_item_age"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:text="@{itemViewModel.age}"
            app:layout_constraintBottom_toBottomOf="@id/list_item_first_name"
            app:layout_constraintStart_toEndOf="@id/list_item_first_name"
            app:layout_constraintTop_toTopOf="@id/list_item_first_name" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/age"
            app:layout_constraintBottom_toBottomOf="@id/list_item_first_name"
            app:layout_constraintStart_toEndOf="@id/list_item_age"
            app:layout_constraintTop_toTopOf="@id/list_item_first_name" />

    </android.support.constraint.ConstraintLayout>
</layout>