我有这个布局。
<data>
<import type="android.view.View" />
<variable
name="shouldBeVisible"
type="java.lang.Boolean" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="@={shouldBeVisible}" />
<LinearLayout
android:layout_width="40dp"
android:layout_height="30dp"
android:background="#dd0"
android:visibility="@{shouldBeVisible ? View.VISIBLE : View.GONE}" />
</LinearLayout>默认情况下,shouldBeVisible为false。有什么方法可以使shouldBeVisible 成为真呢?--我想让LinearLayout在这一种情况下可见。
到目前为止,我正在使用binding.shouldBeVisible=true
发布于 2018-11-13 11:14:20
要解决该错误,可以使用以下几种方法:
选择一个最适合你的需求。
https://stackoverflow.com/questions/53270107
复制相似问题