I\'m working on a custom keyboard for Android, and I\'ve run in to an issue where the keyboard seems to leave a white line/space at right, instead of filling the parent view...
I cannot reproduce the error, I have provided a screenshot, with a light background app and all my relevant code. I am not sure exactly where you are going wrong without seeing the whole project and directories, so I've posted the relevant xml. There is a service class also, I haven't included (as you obviously have it working).
The
code is in a file called qwerty.xml
in the resources/xml folder, with a file called method.xml:
I used all your keyboard dimensions in the qwerty.xml, except I replaced the image.
method.xml
Two layout files:
keyboard.xml
preview.xml
Styles:
In the manifest, within application:
I've left the image so large so you can clearly see there is no gap.
This link here also steps through this code:
http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615
edit 1
After discussion in the comments, I would suggest checking your background style as there are issues/changes with the default background color may be showing for the keyboard window. This is addressed in detail issue in this answer https://stackoverflow.com/a/33052648/3956566. I won't reiterate the details, as the link is unlikely to rot, being an upvoted SO post.
edit 2
Ok Adding the difference in the input method service:
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection ic = getCurrentInputConnection();
switch(primaryCode){
case Keyboard.KEYCODE_DELETE :
ic.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_SHIFT:
caps = !caps;
keyboard.setShifted(caps);
kv.invalidateAllKeys();
break;
case Keyboard.KEYCODE_DONE:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
default:
char code = (char)primaryCode;
if(Character.isLetter(code) && caps){
code = Character.toUpperCase(code);
}
ic.commitText(String.valueOf(code),1);
}
}
edit 3
Create a blank project, no activity for your keyboard, to test and run it as a separate app. You are using android:theme="@style/AppTheme.NoActionBar"
In your launcher activity and there may be an issue with background opacity and your windows/views.