Android数据绑定,属性的值" android:text"与元素类型相关联" TextView"不得包含'<'字符

时间:2016-12-05 09:12:41

标签: android android-layout android-databinding

我正在使用 Android数据绑定库。我要求如果绑定数小于10,我需要显示一个零附加(如0105),否则显示正常数字。

这是我布局的相关部分:

<TextView
     android:id="@+id/tlm_no"
     style="@style/BlackSmallTextStyle"
     android:layout_width="@dimen/study_plan_icon_width"
     android:layout_height="wrap_content"
     android:layout_below="@id/tlm_image"
     android:gravity="center"
     android:fontFamily="sans-serif-light"
     android:text="@{studyPlanDetailVM.studyPlanDetail.learningPlanResource[0] < 10 ? `0` + studyPlanDetailVM.studyPlanDetail.learningPlanResource[0] : studyPlanDetailVM.studyPlanDetail.learningPlanResource[0]}" />

但是当我构建项目时,它会抛出以下错误: The value of attribute “android:text” associated with an element type “TextView” must not contain the '<' character

我该如何解决这个问题?

0 个答案:

没有答案