我在xml中有一个微调框
<Spinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/expense_category"
android:entries="@{()->createExpenseViewModel.getAllSourceItems(1)}"
app:layout_constraintStart_toStartOf="@+id/textView"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintWidth_percent="0.7"
/>
createExpenseViewModel.getAllSourceItems(1)方法返回 包含自定义对象源
的列表的LiveData列表我只想将此对象的属性(即SourceName)绑定到此微调器,如何实现此功能?如果我写一个绑定适配器,我将不得不在setEntries方法内创建一个数组适配器,我不想创建该数组适配器,有没有绑定适配器的方法吗?