Android自定义键盘? [英] Android custom keyboard?

查看:426
本文介绍了Android自定义键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我正在为我的应用程序开发Custom KEYBOARD.

Hello I am working on Custom KEYBOARD for my app.

<Keyboard
         android:keyWidth="%10p"
         android:keyHeight="50px"
         android:horizontalGap="2px"
         android:verticalGap="2px" >
     <Row android:keyWidth="32px" >
         <Key android:keyLabel="A" />
         ...
     </Row>
     ...
 </Keyboard>

我想知道是否有任何方法或android标签可用于设置键盘面板key的可见性或不可见性.

I want to know is there any method or android tag available for set invisible or visible the keyboard board key.

android:visibility="gone" or setVisibility(View.GONE)类似,对于Keyboard布局.

因为在我的应用中键盘的变化很多.

Cause in my app there are many variation in Keyboard.

有关此的任何信息.

推荐答案

可以通过更改键的宽度来隐藏键.

It is possible to hide a key by changing the width of a key.

以下是隐藏语言切换键的示例:

The following is an example of hiding language-switch key:

void setLanguageSwitchKeyVisibility(boolean visible) {
    if (visible) {
        // The language switch key should be visible. Restore the size of the mode change key
        // and language switch key using the saved layout.
        mModeChangeKey.width = mSavedModeChangeKey.width;
        mModeChangeKey.x = mSavedModeChangeKey.x;
        mLanguageSwitchKey.width = mSavedLanguageSwitchKey.width;
        mLanguageSwitchKey.icon = mSavedLanguageSwitchKey.icon;
        mLanguageSwitchKey.iconPreview = mSavedLanguageSwitchKey.iconPreview;
    } else {
        // The language switch key should be hidden. Change the width of the mode change key
        // to fill the space of the language key so that the user will not see any strange gap.
        mModeChangeKey.width = mSavedModeChangeKey.width + mSavedLanguageSwitchKey.width;
        mLanguageSwitchKey.width = 0;
        mLanguageSwitchKey.icon = null;
        mLanguageSwitchKey.iconPreview = null;
    }
}

编辑LatinKeyboard以隐藏密钥.

这篇关于Android自定义键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆