【发布时间】:2017-01-12 09:21:02
【问题描述】:
我一直在尝试使用 android 数据绑定中的隐式属性侦听器 (reference) 来控制视图的可见性,它允许通过 id 访问视图并访问已检查、可见等属性...,但是当尝试使用它,它会抛出这样的错误
Error:(119, 29) Identifiers must have user defined types from the XML file. addTodo_switch_remind is missing it
<android.support.v7.widget.SwitchCompat
android:id="@+id/addTodo_switch_remind"
style="@style/MediumTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/addTodo_space_project"
android:text="@string/add_todo_remind_label"
android:textOff="@string/generic_no_text"
android:textOn="@string/generic_yes_text" />
<android.support.v4.widget.Space
android:id="@+id/addTodo_space_remind"
style="@style/FormsSpacingStyle"
android:layout_below="@+id/addTodo_switch_remind" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/addTodo_space_remind"
android:orientation="vertical"
android:padding="@dimen/grid_box_single"
android:visibility="@{addTodo_switch_remind.checked ? View.VISIBLE : View.GONE}">
【问题讨论】:
-
发布您正在使用的 xml 和 BindingAdapter
标签: android android-databinding