你如何禁用SoftKeyboard键preVIEW窗口?窗口、SoftKeyboard、preVIEW

2023-09-06 08:46:47 作者:'呆呆小逗比ゞ

在创建自己的SoftKeyboard您将得到一个关键preVIEW默认情况下。

When creating your own SoftKeyboard you are given a "key preview" by default.

你如何禁用此?

编辑:

您可以自定义键preVIEW 通过改变&LT布局; KeyboardView> 属性安卓键previewLayout 。这是默认风格看keyboard_key_$p$pview.xml:

You can customise the keyPreview layout by changing the <KeyboardView> attribute android:keyPreviewLayout. This is styled by default to look at keyboard_key_preview.xml:

编辑2: 继我是一个红色的鲱鱼:的

该人士$ ​​C $ C建议提供0或不适用标签的android:关键previewLayout 将导致无钥匙preVIEW出现:

The source code suggests supplying 0 or not applying the tag android:keyPreviewLayout will result in no key preview appearing:

    ...
    case com.android.internal.R.styleable.KeyboardView_keyPreviewLayout:
        previewLayout = a.getResourceId(attr, 0);
        break; 
    ...
    if (previewLayout != 0) {
        mPreviewText = (TextView) inflate.inflate(previewLayout, null);
        mPreviewTextSizeLarge = (int) mPreviewText.getTextSize();
        mPreviewPopup.setContentView(mPreviewText);
        mPreviewPopup.setBackgroundDrawable(null);
    } else {
        mShowPreview = false;
    }  

我已经试过:

I've tried:

系统风格KeyboardView无钥匙previewLayout(奇怪的是,虽然更换这个值改变的preVIEW的风格。) 在我做了一个键previewLayout 引用一个ID为0的值(这会导致系统崩溃的通胀)。 A styled KeyboardView with no keyPreviewLayout (Strangely though replacing this value changed the style of the preview.) I made a keyPreviewLayout reference an id with a value of 0 (which causes a crash on inflation).

难住了。 :(任何帮助将是很大的AP preciated!

Stumped. :( Any help would be greatly appreciated!

推荐答案

还有一个方法:

public void setPreviewEnabled(boolean previewEnabled)

但我不知道在启动API的版本。

But I don't know which version of the API that starts at.