0
我使用数据绑定,在这里我得到这个问题:无法找到属性的getter“机器人:标签” - 安卓
Error:(252, 21) Cannot find the getter for attribute 'android:tag'
with value type java.lang.String on com.hdfcfund.investor.views.EditText.
虽然,文本属性工作正常,但在使用标签元素得到错误。
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="presenter"
type="com.hdfcfund.investor.folio.step4addnominee.AddNomineePresenter" />
<variable
name="nominee"
type="com.hdfcfund.investor.folio.step1.model.NewInvestorFolioRequest.Nominee" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clickable="true">
<com.hdfcfund.investor.views.EditText
android:id="@+id/et_country"
style="@style/EditTextStyleRegularGrey15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_arrow_input"
android:focusableInTouchMode="false"
android:hint="@string/label_country_1"
android:inputType="text"
android:onClick="@{()-> presenter.onSpinnerClick(spinnerCountry)}"
android:tag="@={nominee.nomineeAddress.countryCode}"
android:text="@={nominee.nomineeAddress.countryName}" />
</RelativeLayout>
</layout>
我建议使用'String.valueOf()'而不是转换。 – tynn
@tynn,谢谢你的评论 – Sergey