【发布时间】:2013-08-15 23:31:00
【问题描述】:
我正在开发自定义键盘应用程序
这是软键盘中input.xml的背景颜色代码:-
@Override
public View onCreateInputView() {
Log.e("onStartInputView ","On StartInput View Called--");
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String Backgroundcolour = preferences.getString("BackgroundColour","");
Log.e("Brithnesss- -","----"+Backgroundcolour);
if(Backgroundcolour.equalsIgnoreCase("black"))
{
this.mInputView = (KeyboardView) getLayoutInflater().inflate(
R.layout.input, null);
}else
{
this.mInputView = (KeyboardView) getLayoutInflater().inflate(
R.layout.input1, null);
//this.mInputView.setB
}
this.mInputView.setOnKeyboardActionListener(this);
this.mInputView.setKeyboard(this.mQwertyKeyboard);
return this.mInputView;
}
@Override public void onStartInputView(EditorInfo attribute, boolean restarting) {
super.onStartInputView(attribute, restarting);
// Apply the selected keyboard to the input view.
setInputView(onCreateInputView());
}
我不知道如何为特定键设置背景图像。
【问题讨论】:
-
我的表格不太正确,你能告诉我如何设置不同的颜色键吗?
-
我需要为特定的键背景设置背景,而不是为整个键盘设置相同的键背景图像。我急需
-
嗨@user...我已经完成了彩色按键,但按键中的文字不可见..你能帮帮我吗?
标签: android android-softkeyboard soft-keyboard