I have multiple Edittext in my activity i want to hide by defult keyboard when view shows and show keyboard only when edittext is clicked i am not getting how to do this thanks Advance:)
2
-
there are lots of answer, non of them working ?Chintan Khetiya– Chintan Khetiya2013-05-11 09:08:16 +00:00Commented May 11, 2013 at 9:08
-
Here is also a hack for you, only added a linearlayout into your xml file. gist.github.com/XinyueZ/cc0be271686491dcf6e6TeeTracker– TeeTracker2014-08-20 12:11:58 +00:00Commented Aug 20, 2014 at 12:11
Add a comment
|
1 Answer
try this.
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
answer_et.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit_text.getWindowToken(), 0);
}
}, 100);
}
sometime edittext get focus after manually hide soft-keyboard.
so, delay 100 mSeconds and then after hide it forcefully in onResume() method.
1 Comment
android developer
Or just add a view in the top layout, as the first view, as such: <View android:layout_width="0dp" android:layout_height="0dp" android:focusable="true" android:focusableInTouchMode="true"/>