I've a different result in the layout display of the KeyboardView between Galaxy Tab S4 running android 8.1.0 and my phone Galaxy S8 running android 8.0.0. The difference are in the key width and horizontalGap.
Here is the correct keyboard on my phone:
While on the tablet, the keyboard looks like this:
We can see that the keys on 1st, 2nd and 3rd row have not the same width. But they must be of the same size. On the tablet it seems it's resized to take 100% of the parent container. In the same time, the horizontalGap is pushing the keys out of the parent container.
Here is the XML code that defines the keyboard layout:
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="8.5%p"
android:keyHeight="7%p"
android:keyEdgeFlags="left">
<Row>
<Key android:keyLabel="Q" android:keyEdgeFlags="left" />
<Key android:keyLabel="W" />
<Key android:keyLabel="E" />
<Key android:keyLabel="R" />
<Key android:keyLabel="T" />
<Key android:keyLabel="Z" />
<Key android:keyLabel="U" />
<Key android:keyLabel="I" />
<Key android:keyLabel="O" />
<Key android:keyLabel="P" />
<Key android:codes="55000" android:keyIcon="@drawable/del_keyboard" android:isRepeatable="true" android:keyWidth="15%p" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:keyLabel=" " android:keyHeight="0px" android:keyWidth="0px" android:keyEdgeFlags="left" android:horizontalGap="11.75%p"/>
<Key android:keyLabel="A" />
<Key android:keyLabel="S" />
<Key android:keyLabel="D" />
<Key android:keyLabel="F" />
<Key android:keyLabel="G" />
<Key android:keyLabel="H" />
<Key android:keyLabel="J" />
<Key android:keyLabel="K" />
<Key android:keyLabel="L" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:keyLabel=" " android:keyHeight="0px" android:keyEdgeFlags="left" android:keyWidth="0px" android:horizontalGap="20%p"/>
<Key android:keyLabel="Y" />
<Key android:keyLabel="X" />
<Key android:keyLabel="C" />
<Key android:keyLabel="V" />
<Key android:keyLabel="B" />
<Key android:keyLabel="N" />
<Key android:keyLabel="M" android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:keyLabel=" " android:keyHeight="0px" android:keyWidth="0px" android:horizontalGap="25%p"/>
<Key android:codes="55001" android:keyEdgeFlags="left" android:keyIcon="@drawable/white_space_keyboard" android:keyWidth="50%p" />
</Row>
</Keyboard>
For additional information, the keyboardView is in a fragment included in a slidingPaneLayout. Any ideas what's going on here? Thank you in advance!