您好我正在尝试做一个应用程序,它使用自己的键盘视图而不是默认值。
在搜索区域(Edittext)我不能使用默认光标
我正在研究一个可用的键盘视图示例
活动源代码
package it.anddev.tutorial;
import android.app.Activity;
import android.inputmethodservice.Keyboard;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.EditText;
public class KeyboardWidgetTutorialActivity extends Activity {
private CustomKeyboardView mKeyboardView;
private View mTargetView;
private Keyboard mKeyboard;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mKeyboard = new Keyboard(this, R.xml.keyboard);
mTargetView = (EditText) findViewById(R.id.target);
mTargetView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
showKeyboardWithAnimation();
return true;
}
});
mKeyboardView = (CustomKeyboardView) findViewById(R.id.keyboard_view);
mKeyboardView.setKeyboard(mKeyboard);
mKeyboardView
.setOnKeyboardActionListener(new BasicOnKeyboardActionListener(
this));
}
private void showKeyboardWithAnimation() {
if (mKeyboardView.getVisibility() == View.GONE) {
Animation animation = AnimationUtils
.loadAnimation(KeyboardWidgetTutorialActivity.this,
R.anim.slide_in_bottom);
mKeyboardView.showWithAnimation(animation);
}
}
}
键盘视图是否会阻止该未来或如何启用它?