我正在尝试在没有 gradle 的 Eclipse(Juno) ADT 项目中实现 android 数据绑定库。当我尝试在布局下添加数据标记时,在变量行出现以下错误“属性缺少命名空间前缀”
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable name="user" type="com.example.User"/>
</data>
<LinearLayout
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_horizontal_margin"
tools:context="com.example.exam"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
>
<TextView
android:id="@+id/label_name"
android:layout_marginTop="20dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="CLASS NAME"
android:textColor="@color/colorBlue"
android:textSize="13sp"
/>
</LinearLayout>
</layout>
我认为问题是由于我没有使用 gradle 来构建我的项目,因此我在 ADT 非 gradle 项目中没有以下等效项
android {
....
dataBinding {
enabled = true
}
}
任何人都可以帮助我如何将数据绑定用于非 gradle ADT eclipse 项目?
gradle 构建确实会生成为您绑定的编译时类,因此如果您不使用 gradle 并且 Google 没有提供其他解决方案,您将需要转向其他解决方案。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句