Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android default keyboard layout styling

I am wanting to alter the default (whatever is on your device's) keyboard, so that the colors displayed reflect my apps overarching theme better. for example white background, light blue keys, that go dark blue when pressed.

Using this tutorial I have created a custom Keyboard and am able to change the keybackground.xml to adjust the colors of keys on a KeyboardView etc.

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboardview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:focusableInTouchMode="true" 
    android:visibility="gone"
android:keyBackground="@drawable/keybackground"/>

what I am looking for is to apply this style to the default keyboard used by the device, failing that i have also looked for a copy of the keyboard layout xml so i can create a fully custom one with default key layout.

one possible method i have contemplated is replacing the following line (explained in the tutorial link).

mKeyboardView.setKeyboard(new Keyboard(mHostActivity, layoutid));

with another method of instantiating/getting default Keyboard.

Edit

I only require this keyboard to be displayed within my application.

like image 522
Michael Kent Avatar asked Oct 20 '22 00:10

Michael Kent


1 Answers

You cannot change the colors of any of the installed keyboards (default or not), though some may allow you to create themes for them as a kind of extension but it would be something the user would install separately from your app. Keyboard apps are separate apps from yours and Android doesn't give you direct access to their layouts. You can create your own keyboard app of course, but this wouldn't make sense to do this in your case (as you're only after customizing colors for matching your app).

Additionally, it would be bad UX if each app changed the keyboard colors. Presumably, the user has picked a keyboard and theme that suits his/her visual needs, so it would be annoying if it changed between apps (imagine if you are a color blind user and an app changes the keyboard to colors you can't distinguish so you couldn't see what is on the keys anymore!).

like image 183
FreewheelNat Avatar answered Oct 24 '22 07:10

FreewheelNat