在我的应用程序中,我有一个带有一个图像的编辑文本,用于将任务添加到数据库中。我的问题是,当我在数据库中添加任务之后,android 软键盘可见而不是关闭。我在堆栈溢出中使用所有这些示例,但没有得到结果请任何人帮助我...
<EditText
android:id="@+id/edittextidAddTodayTask"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/edittextselector"
android:drawableRight="@drawable/addtask"
android:hint="AddTask"
android:singleLine="true"
/>
MyOnRightdrawable 监听器:
edittextAddTask.setOnTouchListener(new RightDrawableOnTouchListener(
edittextAddTask) {
@Override
boolean onDrawableTouch(MotionEvent event) {
//Add the task in db.
//I am using this code but not working for me
/*InputMethodManager mgr = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(edittextAddTask.getWindowToken(), 0);*/
}
我的edittext截图: