When making a custom keyboard I can get a leading space (space to the left) of a key by using android:horizontalGap="6.25%p.
How do I get trailing space (space to the right)?
android:horizontalGap="6.25%p.
It creates the gap, which is before the key that carries the horizontalGap
attribute.
ie. leading space (space to the left) of a key.
eg.
<Row>
<Key android:codes="69" android:keyLabel="E" android:horizontalGap="6.25%p" />
<Key android:codes="70" android:keyLabel="F" />
</Row>
Now add a horizontalGap
(on Keyboard level) that is greater than 0, the horizontalGap
(on Key level) no longer creates a gap before but now after the key that carries the horizontalGap
attribute.
ie. trailing space (space to the right) of a key
For me on Android 5.1 android:horizontalGap
attribute works in following way:
android:keyWidth
more than 100 then gap is displayed after key for which it was specified.For example. In this case it is before
<Row>
<Key android:codes="97" android:keyLabel="a" android:horizontalGap="5%p" android:keyEdgeFlags="left"/>
<Key android:codes="115" android:keyLabel="s"/>
<Key android:codes="100" android:keyLabel="d"/>
<Key android:codes="102" android:keyLabel="f"/>
<Key android:codes="103" android:keyLabel="g"/>
<Key android:codes="104" android:keyLabel="h"/>
<Key android:codes="106" android:keyLabel="j"/>
<Key android:codes="107" android:keyLabel="k"/>
<Key android:codes="108" android:keyLabel="l"/>
<Key android:codes="66" android:keyIcon="@drawable/enter_key" android:keyWidth="20%p" android:isRepeatable="true" android:keyEdgeFlags="right"/>
</Row>
And when I change only one value the gap appears after:
<Row>
<Key android:codes="97" android:keyLabel="a" android:horizontalGap="5%p" android:keyEdgeFlags="left"/>
<Key android:codes="115" android:keyLabel="s"/>
<Key android:codes="100" android:keyLabel="d"/>
<Key android:codes="102" android:keyLabel="f"/>
<Key android:codes="103" android:keyLabel="g"/>
<Key android:codes="104" android:keyLabel="h"/>
<Key android:codes="106" android:keyLabel="j"/>
<Key android:codes="107" android:keyLabel="k"/>
<Key android:codes="108" android:keyLabel="l"/>
<Key android:codes="66" android:keyIcon="@drawable/enter_key" android:keyWidth="22%p" android:isRepeatable="true" android:keyEdgeFlags="right"/>
</Row>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With