I am building an android custom keyboard based on https://github.com/android/platform_development/tree/master/samples/SoftKeyboard
They have qwerty and symbols keyboard under res/xml folder. I have added a dummy keyboard (friendlist.xml) like below:
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="20%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="20%p"
>
</Keyboard>
I need to add in "Key" programmatically into this Keyboard (friendlist.xml). In SoftKeyboard.java,
I added the following:
private LatinKeyboard mFriendlistKeyboard;
@Override public void onInitializeInterface() {
if (mQwertyKeyboard != null) {
// Configuration changes can happen after the keyboard gets recreated,
// so we need to be able to re-build the keyboards if the available
// space has changed.
int displayWidth = getMaxWidth();
if (displayWidth == mLastDisplayWidth) return;
mLastDisplayWidth = displayWidth;
}
mQwertyKeyboard = new LatinKeyboard(this, R.xml.qwerty);
mSymbolsKeyboard = new LatinKeyboard(this, R.xml.symbols);
mSymbolsShiftedKeyboard = new LatinKeyboard(this, R.xml.symbols_shift);
mFriendlistKeyboard = new LatinKeyboard(this, R.xml.friendlist);
}
But I couldn't find any function that can add Row and Key into the Keyboard at runtime.
Appreciate any help please. Thanks !
Cheerio, Mark Thien