I am starting to work with the new data binding API. I want to bind on a TextView a custom property where I change the text and background at once. As far I understood the api there is a @BindingMethod annotation for this, but the documentation is there a little weak.
I want something like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Important"
tools:background="@drawable/bg_badge_important"
tools:textColor="#fff"
android:id="@+id/badge"
custom:badge="@{item.badge}"/>
Where this item.badge is a string like important or notice. For i18n I cannot use this string directly but this will help me to choose the right text and the right background image.
Can you give me a small example or a reference how to use this attribute? I just found one answer on Stack Overflow, but this does not answer my question.