2013-06-21 149 views
1

你好,我正在为我的应用程序在Custom KEYBOARD上工作。Android自定义键盘?

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

我想知道是否有任何可供设置为不可见或可见键盘板key方法或Android标签。

like android:visibility="gone" or setVisibility(View.GONE) for Keyboard layout。

原因在我的应用程序中有许多变化的键盘。

有关这方面的任何信息。

+0

这可能会有所帮助..... http://stackoverflow.com/questions/16174179/set-keyboard-mode-in-android-custom-keyboard?rq = 1 – ASP

+0

雅是它的好链接..我会给它尝试。谢谢,但我不知道我会得到我的要求与否。但再次感谢。 – Unknown

+0

绝对有可能这样做。你必须修改你想要的可见性模式的那个键的LatinKeyboard行为。 –

回答

0

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

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

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来隐藏密钥。