EditText request focus not working

后端 未结 11 656
自闭症患者
自闭症患者 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:26

    Following saleh sereshki's answer and pauminku's comment, I'm using:

    m_SearchEditText.post(new Runnable() {
                @Override
                public void run() {
                    m_SearchEditText.requestFocus();
                }
            });
    

    which in Kotlin is the equivalent to:

    m_SearchEditText.post { m_SearchEditText.requestFocus() }
    

提交回复
热议问题