Я пытаюсь повторно использовать кнопку клавиатуры, передавая цифры, например, 1-9, и несколько букв под номером, например, "ab c", "def" и c. По какой-то причине я не могу заставить это работать. Ниже вы можете увидеть код и все, что я сделал. Я прочитал весь inte rnet, но просто не могу заставить его работать.
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="mainText"
type="String"/>
<variable
name="subtitleText"
type="String"/>
</data>
<FrameLayout android:layout_height="85dp"
android:layout_width="85dp"
android:background="@drawable/button_bg_round">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{mainText}"
android:textSize="44sp"
android:fontFamily="@font/latoregular"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingRight="2dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{subtitleText}"
android:textSize="15sp"
android:fontFamily="@font/latoregular"
android:gravity="center"
android:paddingTop="50dp"
android:paddingRight="2dp"
/>
</FrameLayout>
</layout>
Я повторно использую компонент здесь
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bind="http://schemas.android.com/apk/res-auto">
...
<include
android:id="@+id/button_1"
layout="@layout/keypad_layout"
app:mainText="@{@string/keyboard_1}"
bind:mainText ="@{@string/keyboard_1}"
app:subtitleText="@{@string/keyboard_1_subtitle}"
/>
...
</layout>
и, наконец, у меня есть добавлена привязка данных в build.gradle.