【发布时间】:2015-10-07 15:24:28
【问题描述】:
我正在尝试使用新的 Android 数据绑定库并在尝试使用所选值填充微调器时遇到以下错误。
错误信息(在 Android Studio 中编译期间):
错误:任务 ':app:compileDebugJavaWithJavac' 执行失败。 java.lang.RuntimeException:发现数据绑定错误。 ****/ 数据绑定错误 ****msg:找不到参数类型为 java.lang.String 的属性“app:selection”的设置器。文件:/Users/ove/Code/AndroidStudio/Samples/Receipts/app/src/main/res/layout/dialogfragment_inputamount_db.xml loc:40:29 - 40:44 ****\数据绑定错误 ****
我的布局文件如下所示(不完整):
<?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="receipt"
type="com.example.model.Receipt" />
</data>
</LinearLayout>
<Spinner
android:layout_width="wrap_content"
android:id="@+id/currency"
android:layout_height="wrap_content"
android:spinnerMode="dropdown"
android:entries="@array/currency_array"
app:selection="@{receipt.currency}" />
</LinearLayout>
</layout>
有没有人设法让数据绑定与微调器一起工作?
过
【问题讨论】: