Automatic popping up keyboard on start Activity

后端 未结 19 1055
醉梦人生
醉梦人生 2020-11-28 23:05

I got a relative simple question. I have an activity with a lot of EditText\'s in them. When I open the activity it automatically focusses to the first EditText and displays

19条回答
  •  [愿得一人]
    2020-11-28 23:51

    this is the solution I am using, is not the best solution but it's working well for me

     editComment.setFocusableInTouchMode(false);
     editComment.setOnTouchListener(new OnTouchListener(){
    
                    @Override
                    public boolean onTouch(View v, MotionEvent event)
                    {
                        // TODO Auto-generated method stub
                        editComment.setFocusableInTouchMode(true);
                         editComment.requestFocus() ;
                        return false;
                    }});
    

提交回复
热议问题