Monday, February 14, 2011

Remove Auto focus from Edit Text



When start Android application, it always auto focus EditText box. Here we give explain how to remove auto focus from EditText.


Add your main.xml file to below additional code.




After add above code, you can remove auto focus from EditText.



Sameeraa4ever

14 comments:

  1. add android:focusableInTouchMode="true" in EditBox .

    ReplyDelete
  2. it is not working
    please do it this way

    In Activity Class
    editText.clearFocus();

    ReplyDelete
  3. please tell me how can i enter the value in focusableInTouchMode edittext

    ReplyDelete
  4. Thanks, worked with dhraham suggestion!

    ReplyDelete
  5. HI this helped but i have hint in the text box when i click for the first time my onClick is not getting called so i have to click twice to remove my hint

    ReplyDelete
  6. Best and easiest answer is that.

    add android:windowSoftInputMode="stateHidden" in activity tag where in androidmanifest.xml

    here details :

    http://www.erhancetin.com.tr/2013/09/android-activity-ilk-acls-edittext.html

    ReplyDelete
  7. Thanks Its fine well

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

    add this code to activity create event

    add all well fine.

    ReplyDelete