Я новичок в привязке данных и пытаюсь связать просмотрщик и получаю следующую ошибку. Я следую за хранилищем github.
android.databinding.tool.util.LoggedErrorException: найдено связывание данных
error.data ошибка привязки
msg: не удается найти установщик для
атрибут app: data с типом параметра
java.util.List on
android.support.v7.widget.RecyclerView. файл: D: \ Android \ All
Demo \ TextAndImageSwitcher \ приложение \ SRC \ главная \ Рез \ расположение \ activity_list_data_binding.xml
loc: 17: 24 - 17:45 \ ошибка привязки данных
посмотреть файл модели:
public class ListViewModel extends BaseObservable
{
private Context context;
public ListRecyclerAdapter listRecyclerAdapter;
public List<User> userList;
public ListViewModel(final Context context)
{
this.context = context;
userList = new ArrayList<>();
listRecyclerAdapter = new ListRecyclerAdapter(context, userList);
}
public void setUp()
{
populateData();
}
public void tearDown()
{
}
@Bindable
public List<User> getData()
{
return this.userList;
}
@Bindable
public ListRecyclerAdapter getListRecyclerAdapter()
{
return this.listRecyclerAdapter;
}
private void populateData() {
for (int i =0;i<=50;i++){
userList.add(new User("Name("+i+")", "Mobile("+i+")", "Email("+i+")", "Address("+i+")"));
}
notifyPropertyChanged(BR.data);
}
}
мой xml файл:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="listViewModel"
type="com.example.admin.textandimageswitcher.ListViewModel"/>
</data>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ListDataBindingActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:adapter="@{listViewModel.listRecyclerAdapter}"
app:data="@{listViewModel.userList}"
android:id="@+id/list_data_binding_recycler">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</layout>