Search code examples
androidandroid-keypad

Spacing in custom keyboard


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)?


Solution

  • 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