【发布时间】:2020-01-08 10:19:33
【问题描述】:
我在mainActivity下有一个fragment,而mainActivity使用数据绑定包裹fragment:
// activity_main.xml
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:id="@+id/loginFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</layout>
LoginFragment 还使用与 LoginViewModel 的数据绑定:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="loginViewModel"
type="com.example.LoginViewModel" />
</data>
...
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
但是当我编译项目时,import com.example.dccandroidapp.FragmentLoginBindingImpl;这行,却报错说明绑定是假的。
【问题讨论】:
-
添加完整的堆栈跟踪
标签: android kotlin data-binding