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

5

24

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?

Wheel answered 10/6, 2015 at 12:55 Comment(3)
Screenshots or mock picture will help understand the issue better.Kauri
@AndroidMechanic Here you go: pasteboard.co/1gjEd5Ye.jpg There is this white square appearing when I long-press on the popup keyboard..Affranchise
Can you post your keyboardView please?Gazelle
S
4

set this in your popup layout set this attribute:

android:keyPreviewLayout="0"

or

android:keyPreviewLayout="@null"
Spinster answered 8/2, 2016 at 8:44 Comment(0)
A
3

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); 
Adkison answered 3/2, 2016 at 14:28 Comment(1)
Where do I write that?Affranchise
W
3

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>
Warrior answered 4/2, 2016 at 12:46 Comment(0)
G
1

In your keyboardView set a layout for your popup with

android:popupLayout=""

And in your popup layout set this attribute:

android:keyPreviewLayout="@null"
Gazelle answered 4/2, 2016 at 16:10 Comment(0)
W
0

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

Warrior answered 5/2, 2016 at 10:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.