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

后端 未结 30 2756
别那么骄傲
别那么骄傲 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:19

    Add following in onCreate method:

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    

提交回复
热议问题