Prevent the keyboard from displaying on activity start

后端 未结 17 712
轮回少年
轮回少年 2020-11-30 17:26

I have an activity with an Edit Text input. When the activity is initialized, the Android keyboard is shown. How can the keyboard remain hidden until the user

17条回答
  •  有刺的猬
    2020-11-30 17:58

    You can also write these lines of code in the direct parent layout of the .xml layout file in which you have the "problem":

    android:focusable="true"
    android:focusableInTouchMode="true"
    

    For example:

    
    
    
        
    
        


    EDIT :

    Example if the EditText is contained in another layout:

    
                                                
    
        ...    
    
                
    
            
    
            

    The key is to make sure that the EditText is not directly focusable.
    Bye! ;-)

提交回复
热议问题