I wanted to reuse text fields and hold them separately in XML file as independent components. I'm using data binding to bind string resources.
It worked fine if those components were not split into independent XML files, but now as I've used include tag, it is not displaying any resource strings in App. What can be wrong?
Code example:
Main layout
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable name="CustomRes" type="com.project.utils.CustomResources"/>
</data>
<LinearLayout
android:id="@+id/mainContentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/padding_medium">
<include layout="@layout/form_name"/>
<include layout="@layout/form_email"/>
<include layout="@layout/form_phone"/>
</LinearLayout>
</layout>
Included Layout example:
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable name="CustomRes" type="com.project.utils.CustomResources"/>
</data>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextInputLayoutStyle"
app:errorEnabled="true"
android:hint='@{CustomRes.stringValues["form_name"]}'>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/nameEt"
android:layout_width="match_parent"
android:inputType="textCapWords"
android:singleLine="true"
app:errorEnabled="true"
android:focusable="true"
android:focusableInTouchMode="true"
style="@style/TextInputEditTextStyle"/>
</com.google.android.material.textfield.TextInputLayout>
</layout>