Skip to content

Instantly share code, notes, and snippets.

@longv
Created November 3, 2019 09:42
Show Gist options
  • Save longv/d5c2ad83a9aa786393f42439f547e156 to your computer and use it in GitHub Desktop.
Save longv/d5c2ad83a9aa786393f42439f547e156 to your computer and use it in GitHub Desktop.
Usage of model attribute in data binding RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="listModel"
type="androidx.lifecycle.LiveData&lt;me.longv.pokedex.databinding.RecyclerViewModel>"/>
</data>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:model="@{listModel}"/>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment