I am using the Android Data Binding library. I have a requirement that if the bound number is less than 10, I need to show it with a zero appended (like 01
, 05
), and else show the normal number.
Here's the relevant part of my layout:
<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]}" />
But when I build the project it throws the following error:
The value of attribute “android:text” associated with an element type “TextView” must not contain the '<' character
How can I solve this issue?
Use <
instead of <
Use >
instead of >
Use &
instead of &
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With