Fedor Tsyganov
Fedor Tsyganov

Reputation: 1002

Android keyboard popup character not showing

I have created a custom keyboard and everything works fine except popup characters that are not showing when I long press the key on my keyboard. Do you know to fix it, so that popup characters will be present as an option and user can select them?

<Keyboard ...>
    <Row>
       <Key android:codes="46" android:keyLabel="." android:popupCharacters=","/>
    </Row>
</Keyboard>

This is how it looks when I press a key on a keyboard. Popup character "," is not showing.

View of the keyboard in action

My preview layout: preview.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="30dp"
      android:layout_height="40dp"
      android:gravity="center"
      android:background="@drawable/round_preview"
      android:textStyle="bold"
      android:textSize="20sp"
      android:textColor="@color/colorPrimaryDark"/>

Thanks.

Upvotes: 2

Views: 1420

Answers (1)

Fedor Tsyganov
Fedor Tsyganov

Reputation: 1002

Okay, I figured out what was the problem:

for a popupCharacter you need to include a populLayout

character:

<Key android:codes="46,63,33" android:keyLabel="."  android:keyWidth="10%p" android:popupCharacters=",?!" android:popupKeyboard="@xml/popup_symbols" />

and popup_symbols.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
      android:keyWidth="10%p"
      android:horizontalGap="0px"
      android:verticalGap="0px"
      android:keyHeight="40dp" >
</Keyboard>

Upvotes: 2

Related Questions