Su qualsiasi differente ingresso la layout uso android: keyBackground = ".."
esempio:
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"
/>
quindi sul metodo OnCreateInputView:
@Override public View onCreateInputView() {
if(theme == 1)
mInputView = (KeyboardView) getLayoutInflater().inflate(R.xml.input , null);
else
mInputView = (KeyboardView) getLayoutInflater().inflate(R.xml.input1 , null);
mInputView.setOnKeyboardActionListener(this);
mInputView.setKeyboard(mQwertyKeyboard);
mComposing.setLength(0);
return mInputView;
}
e alla fine del metodo onStartInput aggiungere questo:
setInputView(onCreateInputView());
Se hai già fatto e ciò che è necessario è quello di impostare uno sfondo diverso a tasti speciali. Forse la soluzione al mio problema che ho scritto ti aiuterà: https://stackoverflow.com/a/18354298/2683898
Buona fortuna! :)
Cosa hai provato finora? Fornire il codice di ciò che hai provato ti aiuterà ad ottenere aiuto. –
ho impostato su input.xml e input1.xml – user
ho bisogno di ottenere keycode in fase di runtime, ovvero colore chiave differente ho usato tre input.xml, input1.xml, input2.xml se input.xml viene gonfiato rispetto a keycolor sarà verde , combinazione blu se input1.xml gonfia le chiavi colore di sfondo sarà rosso e arancione .. simile per input2.xml quindi non ho capito come fare a questo – user