为什么数据绑定不像 android 命名空间的自定义名称
why does databinding not like a custom name for the android namespace
我注意到,当我将数据绑定与布局一起使用时,如果更改 android 命名空间名称,则会出现编译错误。
这个街区
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="object"
type="<PATH_TO_DATA_CLASS>"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</layout>
编译。这个块
<layout
xmlns:a="http://schemas.android.com/apk/res/android">
<data>
<variable
name="object"
type="<PATH_TO_DATA_CLASS>"/>
</data>
<LinearLayout
a:layout_width="match_parent"
a:layout_height="match_parent"/>
</layout>
构建出错
error: unbound prefix. (at the line <LinearLayout)
其他不使用数据绑定的布局使用较短的名称进行编译。
有人知道为什么以及如何解决这个问题吗?
Does anybody know why
大概是一个错误。我提交了 an issue,因为数据绑定应该能够处理这个问题。
how to get around this?
切换回 android:
,我想。我不知道有什么方法可以让数据绑定注意备用命名空间前缀。
我注意到,当我将数据绑定与布局一起使用时,如果更改 android 命名空间名称,则会出现编译错误。
这个街区
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="object"
type="<PATH_TO_DATA_CLASS>"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</layout>
编译。这个块
<layout
xmlns:a="http://schemas.android.com/apk/res/android">
<data>
<variable
name="object"
type="<PATH_TO_DATA_CLASS>"/>
</data>
<LinearLayout
a:layout_width="match_parent"
a:layout_height="match_parent"/>
</layout>
构建出错
error: unbound prefix. (at the line <LinearLayout)
其他不使用数据绑定的布局使用较短的名称进行编译。 有人知道为什么以及如何解决这个问题吗?
Does anybody know why
大概是一个错误。我提交了 an issue,因为数据绑定应该能够处理这个问题。
how to get around this?
切换回 android:
,我想。我不知道有什么方法可以让数据绑定注意备用命名空间前缀。