我正在开发自定义键盘应用程序
这是软键盘中背景颜色的代码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());
}
我不知道如何为特定键设置背景图像。