私はカスタムキーボードアプリケーションを開発中です。私はKeyboardViewクラスのキーや背景色を別のテーマに設定し、SoftKeyboardのonCreateInputView()でキーカラーを取得する必要がありますInputMethodServiceクラスを拡張します。カスタムAndroidキーボードでKeyboardViewクラスのキーの色を変更するには?
しかし、特定のキーの色や背景を変更できるように、キーコードに応じて特定のキーを取得する方法がわかりません。 keyBackground = ".."
例:
input.xmlに:
<com.example.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:keyBackground="@drawable/blue_key"
/>
input1.xml:
<com.example.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:keyBackground="@drawable/red_key"
/>
任意切り抜い入力レイアウト使用Androidの
これまでに何を試しましたか?試したことのコードを入力すると、助けを得るのに役立ちます。 –
私はinput.xmlとinput1.xmlに設定しました – user
実行時にキーコードを取得する必要があります。つまり、異なるキーカラーですinputc.xml、input1.xml、input2.xmlを使用しました。 、input1.xmlの場合は青の組み合わせ、背景の色は赤とオレンジになります.. input2.xmlと同じように、私はこの方法を知りません。 – user