How to prevent focus on Activity start

This question already has an answer here:

  • Stop EditText from gaining focus at Activity startup 46 answers

  • // Add following code in activity onCreate
            this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    

    对于父级布局android:focusableInTouchMode="true"


    您可以像设置布局的属性

    android:descendantFocusability="beforeDescendants"
    android:focusableInTouchMode="true"
    
    链接地址: http://www.djcxy.com/p/24176.html

    上一篇: Android EditText游标

    下一篇: 如何防止关注活动开始