【发布时间】:2019-01-23 18:26:02
【问题描述】:
我正在尝试使用数据绑定在<android.support.design.widget.TextInputLayout> 视图上设置textColorHint,如
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_layout_height"
android:layout_marginBottom="@dimen/text_input_margin_bottom"
android:hint="@{FieldHandlers.hasValidSpaces(account.firstName)? @string/first_name : @string/invalid_firstname}"
app:textColorHint="@{FieldHandlers.hasValidSpaces(account.firstName)? @android:color/holo_red_light : @android:color/holo_red_light}"/>
但是它给出了以下错误消息:
Error:(70, 38) Cannot find the setter for attribute 'app:textColorHint' with parameter type int on android.support.design.widget.TextInputLayout.
有没有办法可以通过这个属性使用数据绑定?如果我直接传入颜色文字或@color/myColor 引用,它会起作用。
【问题讨论】:
-
将“app:textColorHint”改为“android:textColorHint”
标签: android