Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 237
Grrruk Avatar asked Jun 10 '15 12:06

Grrruk


People also ask

How to make keyboard invisible in Android?

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow , passing in the token of the window containing your focused view. This will force the keyboard to be hidden in all situations. In some cases, you will want to pass in InputMethodManager.

How to remove soft keyboard Android?

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow, passing in the token of the window containing your edit field. This will force the keyboard to be hidden in all situations.

What is soft keyboard in Android?

The Android system shows an on-screen keyboard—known as a soft input method—when a text field in your UI receives focus.


2 Answers

set this in your popup layout set this attribute:

android:keyPreviewLayout="0"

or

android:keyPreviewLayout="@null"
like image 122
JAAD Avatar answered Oct 21 '22 21:10

JAAD


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); 
like image 3
TheCodeArtist Avatar answered Oct 21 '22 22:10

TheCodeArtist