如果我点击我的EditText,虚拟键盘简单的不能显示出来。已显示光标,但没有键盘上键入。
If i click on my EditText, the virtual keyboard simple not shows up. The cursor is shown, but no keyboard to type on.
我甚至尝试用手动打开,但只是没有工作。
I even tried it with manually open but just no works.
下面是我的code:
public class CreateNote extends Activity {
EditText titleEdit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.createnote);
titleEdit = (EditText) findViewById(R.id.titleEdit);
titleEdit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager) CreateNote.this
.getSystemService(Service.INPUT_METHOD_SERVICE);
imm.showSoftInput(titleEdit, 0);
}
});
}
}
布局的代码段:
Snippet of Layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#989898" >
<EditText
android:id="@+id/titleEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittextdrawale"
android:ems="10"
android:textColor="#fff"
android:textColorHint="#fff" >
<requestFocus />
</EditText>
</FrameLayout>
有什么能玩捉迷藏的原因,寻求我的虚拟键盘? 我测试在真实的设备,而不是模拟器。
What could be the reason of playing hide and seek of my virtual keyboard ? I test on real device, not on emulator.
试试这个,它为我工作。
Try with this, it worked for me.
EditText etHorseName = (EditText) getView().findViewById(R.id.horseName);
etHorseName.clearFocus();
在的onCreate()
或你想要的。