Android自定义键盘?

时间:2013-06-21 10:21:40

标签: android keyboard android-softkeyboard

您好我正在为我的应用Custom KEYBOARD工作。

<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

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

因为在我的应用中,键盘有很多变化。

有关此事的任何信息。

1 个答案:

答案 0 :(得分:0)

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

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

def groovyScript = '''
//Following line just confirms that the jar file is indeed on the classpath of this script
assert 25 == (new utils.TemperatureUtils()).toCelcius(77)

//Actually using the category now
assert 77.toCelcius()       == 25
assert 25.toFahrenheit()    == 77
'''

def shell = new GroovyShell() 
shell.evaluate(groovyScript)

修改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; } } 以隐藏密钥。

相关问题