1:https://cloud.tencent.com/developer/article/1141285
2:databinding 中include属性不起作用, 如下代码所示,include中visibility属性不会生效。
若想要生效,两个方案:
1:给include 添加一个id。
2:将layout_no_content 修改为databinding写法布局
<include
layout="@layout/layout_no_content"
android:visibility="@{viewmodel.isNoData ? View.VISIBLE :View.GONE}"/>
<layout_no_content.xml>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin_120"
android:gravity="center"
android:orientation="vertical">
</LinearLayout>
3: kotlin使用databinding
Task :app:kaptDebugKotlin FAILED
e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
解决办法:
1:升级gradle插件版本4.0+
2:修改本地jdk <=1.8
网友评论