EditText onClickListener in Android

后端 未结 14 2093
时光取名叫无心
时光取名叫无心 2020-12-02 12:03

I want an EditText which creates a DatePicker when is pressed. So I write the following code:

    mEditInit = (EditText) findViewById(R.id.date_init);
    mE         


        
14条回答
  •  失恋的感觉
    2020-12-02 12:38

    Default working of EditText: On first click it focuses and on second click it handles onClickListener so you need to disable focus. Then on first click the onClickListener will handle.

    To do that you need to add this android:focusableInTouchMode="false" attribute to your EditText. That's it!

    Something like this:

        
    

提交回复
热议问题