user1715925
user1715925

Reputation: 607

android softkeyboard key not hitting properly

I'm modifying the sample softkeyboard app from the android sdk. I noticed that the alphabet keys seem to get hit even if I touch at position below the key. More specifically, if I touch near the top boundary of the "A" key, then the keyboard actually registers "Q" instead. It seems the bounding rectangle for each key extends to the empty space below it and sometimes even owning some top portion of the key below.

In addition, I tried modifying the layout of the bottom row so that the space key is larger as below. However, as soon as I do this, there is a portion to the right of the space key that does not register when I touch. This region seems to occupy 10% of the width. Any ideas how I can debug these issues?

  <Row android:rowEdgeFlags="bottom">
        <Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p" android:keyEdgeFlags="left"/>
        <Key android:codes="32" android:keyWidth="55%p" android:isRepeatable="true"/>
        <Key android:codes="46" android:keyLabel="." android:keyWidth="10%p"/>
        <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" 
                android:keyWidth="20%p" android:keyEdgeFlags="right"/>
    </Row>

Upvotes: 2

Views: 530

Answers (1)

user1715925
user1715925

Reputation: 607

Found the answer for the space key portion of the above: android custom keyboard: touch area of space key not completely covered

As for the vertical correction, @ChrisStratton is correct. I looked into it and all I had to do was add android:verticalCorrection="0dp" to res\layout\input.xml and keys started hitting correctly.

Upvotes: 3

Related Questions