How to stop EditText from gaining focus at Activity startup in Android

后端 未结 30 3271
别那么骄傲
别那么骄傲 2020-11-21 06:40

I have an Activity in Android, with two elements:

  1. EditText
  2. ListView

When my Activity

30条回答
  •  轮回少年
    2020-11-21 07:30

    The simplest thing I did is to set focus on another view in onCreate:

        myView.setFocusableInTouchMode(true);
        myView.requestFocus();
    

    This stopped the soft keyboard coming up and there was no cursor flashing in the EditText.

提交回复
热议问题