How to disable key preview in popup keyboard (not in main softkeyboard layout)?

3.7k views Asked by At

It's easy to disable key previews: just call setPreviewEnabled(false) and these annoying tiny previews won't show up anymore. But if I attach a popup keyboard to any key then these previews will show up inside that popup:

qwerty.xml:

<Key android:codes="101" 
    android:keyLabel="E" 
    android:popupKeyboard="@xml/popup"
   android:keyTextSize="60sp"/>

popup.xml:

<Row>
    <Key android:codes="-10000"
        android:keyLabel="test"
        android:keyOutputText="test"/>
</Row>
<Row>
    <Key android:codes="-10001"
        android:keyLabel="test2"
        android:keyOutputText="test2"/>
</Row>

Can't post images, but if I long press letter 'E' and then press test or test2 button they will show that white key preview.

Is there any way to disable these key previews too?

5

There are 5 answers

1
TheCodeArtist On

Call setPreviewEnabled(false) for the popup keyboard view too

// Find popup keyboard by its view-id
pKeyboardView
android.inputmethodservice.KeyboardView = (KeyboardView)mHostActivity.findViewById(viewid);

// Disable key-previews for the popup keyboard too
pKeyboardView.setPreviewEnabled(false); 
0
AMD On

create a CustomKeyboard with setPreviewEnabled(false) add your rows inside CustomeKeyboard in popup.xml as below

<CustomKeyboard 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:keyWidth="10%p"
        android:horizontalGap="0px"
        android:verticalGap="0px"
        android:keyHeight="60px" >
        <Row><Key android:codes="-10000"
            android:keyLabel="test"
            android:keyOutputText="test"/> </Row> 
        <Row><Key android:codes="-10001"
            android:keyLabel="test2"
            android:keyOutputText="test2"/></Row>
</CustomKeyboard>
0
AMD On

1) Your need to set your popupLayout your current popup layout is this

2) inside your popupLayout set android:keyPreviewLayout="@null" this will hide your preview inside popup

for more description check

0
Ricardo A. On

In your keyboardView set a layout for your popup with

android:popupLayout=""

And in your popup layout set this attribute:

android:keyPreviewLayout="@null"
0
JAAD On

set this in your popup layout set this attribute:

android:keyPreviewLayout="0"

or

android:keyPreviewLayout="@null"