EditText request focus not working

后端 未结 11 642
自闭症患者
自闭症患者 2020-12-15 17:03

I have an EditText and a Button. On click of the button i want to open the EditText keyboard and at the same time request focus on the

11条回答
  •  一整个雨季
    2020-12-15 17:19

    In your manifest.xml write:

    
    

    And call m_SearchEditText.requestfocus() in oncreate().
    OR,
    Try:

    if(m_SearchEditText.requestFocus()) {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    }
    

提交回复
热议问题