How to make EditText not focused when creating Activity











up vote
60
down vote

favorite
17












Before you downvote and mark as duplicate, read my question.



I've read the other questions discussing this, and all of them work for my layouts, except for the very first one created.



At the moment, this is at the top of my onCreate method:



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


^ That makes it so at least the keyboard doesn't pop up on startup, but the EditText is still focused on.



This is the XML for my EditText:



<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/changePass"
android:layout_centerHorizontal="true"
android:layout_marginTop="167dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="30" >
</EditText>


This is what it looks like when I bring up my activity:



enter image description here



The problem is that with some phones, when an EditText is focused like this, they can't write in it. I want it to not focus.



What I've done works for the next layouts brought up in that it the EditTexts are not focused on and would look more like this:



enter image description here



Notice that it's the same layout, though. This is the screen after the user has been brought back to this screen, which would indicate nothing wrong with the XML because this is the same XML, but the problem is that the EditText is only focused on when the activity is created.



I've done research and all of the other questions don't help me with this (they did however help the keyboard not show up, thankfully). How can I make it so the EditText on startup will look like the second screenshot, rather than the first?










share|improve this question
























  • so you want to focus on EditText?
    – Pratik Butani
    Aug 18 '13 at 4:59






  • 2




    Have you tried android:focusable="false" in EditText ?
    – Pratik Butani
    Aug 18 '13 at 5:08












  • @PratikButani that makes it so it can never be focused on, though.
    – Michael Yaworski
    Aug 18 '13 at 5:15










  • Adding android:focusableInTouchMode="true" on my parent layout works for me.
    – Marcelo Gracietti
    May 12 '17 at 15:05















up vote
60
down vote

favorite
17












Before you downvote and mark as duplicate, read my question.



I've read the other questions discussing this, and all of them work for my layouts, except for the very first one created.



At the moment, this is at the top of my onCreate method:



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


^ That makes it so at least the keyboard doesn't pop up on startup, but the EditText is still focused on.



This is the XML for my EditText:



<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/changePass"
android:layout_centerHorizontal="true"
android:layout_marginTop="167dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="30" >
</EditText>


This is what it looks like when I bring up my activity:



enter image description here



The problem is that with some phones, when an EditText is focused like this, they can't write in it. I want it to not focus.



What I've done works for the next layouts brought up in that it the EditTexts are not focused on and would look more like this:



enter image description here



Notice that it's the same layout, though. This is the screen after the user has been brought back to this screen, which would indicate nothing wrong with the XML because this is the same XML, but the problem is that the EditText is only focused on when the activity is created.



I've done research and all of the other questions don't help me with this (they did however help the keyboard not show up, thankfully). How can I make it so the EditText on startup will look like the second screenshot, rather than the first?










share|improve this question
























  • so you want to focus on EditText?
    – Pratik Butani
    Aug 18 '13 at 4:59






  • 2




    Have you tried android:focusable="false" in EditText ?
    – Pratik Butani
    Aug 18 '13 at 5:08












  • @PratikButani that makes it so it can never be focused on, though.
    – Michael Yaworski
    Aug 18 '13 at 5:15










  • Adding android:focusableInTouchMode="true" on my parent layout works for me.
    – Marcelo Gracietti
    May 12 '17 at 15:05













up vote
60
down vote

favorite
17









up vote
60
down vote

favorite
17






17





Before you downvote and mark as duplicate, read my question.



I've read the other questions discussing this, and all of them work for my layouts, except for the very first one created.



At the moment, this is at the top of my onCreate method:



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


^ That makes it so at least the keyboard doesn't pop up on startup, but the EditText is still focused on.



This is the XML for my EditText:



<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/changePass"
android:layout_centerHorizontal="true"
android:layout_marginTop="167dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="30" >
</EditText>


This is what it looks like when I bring up my activity:



enter image description here



The problem is that with some phones, when an EditText is focused like this, they can't write in it. I want it to not focus.



What I've done works for the next layouts brought up in that it the EditTexts are not focused on and would look more like this:



enter image description here



Notice that it's the same layout, though. This is the screen after the user has been brought back to this screen, which would indicate nothing wrong with the XML because this is the same XML, but the problem is that the EditText is only focused on when the activity is created.



I've done research and all of the other questions don't help me with this (they did however help the keyboard not show up, thankfully). How can I make it so the EditText on startup will look like the second screenshot, rather than the first?










share|improve this question















Before you downvote and mark as duplicate, read my question.



I've read the other questions discussing this, and all of them work for my layouts, except for the very first one created.



At the moment, this is at the top of my onCreate method:



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


^ That makes it so at least the keyboard doesn't pop up on startup, but the EditText is still focused on.



This is the XML for my EditText:



<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/changePass"
android:layout_centerHorizontal="true"
android:layout_marginTop="167dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="30" >
</EditText>


This is what it looks like when I bring up my activity:



enter image description here



The problem is that with some phones, when an EditText is focused like this, they can't write in it. I want it to not focus.



What I've done works for the next layouts brought up in that it the EditTexts are not focused on and would look more like this:



enter image description here



Notice that it's the same layout, though. This is the screen after the user has been brought back to this screen, which would indicate nothing wrong with the XML because this is the same XML, but the problem is that the EditText is only focused on when the activity is created.



I've done research and all of the other questions don't help me with this (they did however help the keyboard not show up, thankfully). How can I make it so the EditText on startup will look like the second screenshot, rather than the first?







java android focus android-edittext






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 8 '13 at 19:01

























asked Aug 18 '13 at 4:50









Michael Yaworski

9,304144779




9,304144779












  • so you want to focus on EditText?
    – Pratik Butani
    Aug 18 '13 at 4:59






  • 2




    Have you tried android:focusable="false" in EditText ?
    – Pratik Butani
    Aug 18 '13 at 5:08












  • @PratikButani that makes it so it can never be focused on, though.
    – Michael Yaworski
    Aug 18 '13 at 5:15










  • Adding android:focusableInTouchMode="true" on my parent layout works for me.
    – Marcelo Gracietti
    May 12 '17 at 15:05


















  • so you want to focus on EditText?
    – Pratik Butani
    Aug 18 '13 at 4:59






  • 2




    Have you tried android:focusable="false" in EditText ?
    – Pratik Butani
    Aug 18 '13 at 5:08












  • @PratikButani that makes it so it can never be focused on, though.
    – Michael Yaworski
    Aug 18 '13 at 5:15










  • Adding android:focusableInTouchMode="true" on my parent layout works for me.
    – Marcelo Gracietti
    May 12 '17 at 15:05
















so you want to focus on EditText?
– Pratik Butani
Aug 18 '13 at 4:59




so you want to focus on EditText?
– Pratik Butani
Aug 18 '13 at 4:59




2




2




Have you tried android:focusable="false" in EditText ?
– Pratik Butani
Aug 18 '13 at 5:08






Have you tried android:focusable="false" in EditText ?
– Pratik Butani
Aug 18 '13 at 5:08














@PratikButani that makes it so it can never be focused on, though.
– Michael Yaworski
Aug 18 '13 at 5:15




@PratikButani that makes it so it can never be focused on, though.
– Michael Yaworski
Aug 18 '13 at 5:15












Adding android:focusableInTouchMode="true" on my parent layout works for me.
– Marcelo Gracietti
May 12 '17 at 15:05




Adding android:focusableInTouchMode="true" on my parent layout works for me.
– Marcelo Gracietti
May 12 '17 at 15:05












13 Answers
13






active

oldest

votes

















up vote
270
down vote



accepted










You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"



Example:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true" >

<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/changePass"
android:layout_centerHorizontal="true"
android:layout_marginTop="167dp"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="30" >
</EditText>

</RelativeLayout>


May this one helpful ;)






share|improve this answer






























    up vote
    16
    down vote













    XML code:



    <EditText
    android:id="@+id/password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/changePass"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="167dp"
    android:ems="10"
    android:focusable="false"
    android:imeOptions="flagNoExtractUi"
    android:inputType="textPassword"
    android:maxLength="30" >
    </EditText>


    Java code:



    EditText edPwd = (EditText)findViewById(R.id.password);
    edtPwd.setOnTouchListener(new View.OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {

    v.setFocusable(true);
    v.setFocusableInTouchMode(true);
    return false;
    }
    });



    set focusable false in xml and set it true via the code







    share|improve this answer























    • Good solution ... the answer marked correct results in the IME option actionNext failing completely.
      – Y.S.
      Sep 3 '15 at 13:42










    • I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
      – Syeda Zunairah
      May 19 '16 at 11:57




















    up vote
    12
    down vote













    In your main_layout
    add this 2 lines:



    android:descendantFocusability="beforeDescendants"
    android:focusableInTouchMode="true"


    example:



    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:descendantFocusability="beforeDescendants"
    android:focusableInTouchMode="true"> *YOUR LAYOUT CODE* </RelativeLayout>





    share|improve this answer

















    • 1




      Edit Text is not focused but the keyboard is visible.
      – viper
      Jan 3 '17 at 4:29


















    up vote
    2
    down vote













    Add this in onCreate()



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


    or in onCreateView()



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





    share|improve this answer




























      up vote
      1
      down vote













      XML Code



      <EditText 
      android:imeOptions="flagNoExtractUi"
      android:focusable="false"
      />


      Java Code in onClickListerner



       mEdtEnterPhoneNumber.setFocusable(true);
      mEdtEnterPhoneNumber.setFocusableInTouchMode(true);





      share|improve this answer




























        up vote
        1
        down vote













        the best solution is here:
        https://stackoverflow.com/a/45139132/3172843



        the correct and simple solution is to setFocusable false and setFocusableInTouchMode true . so the EditText gain focus only when user touch that EditText



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





        share|improve this answer




























          up vote
          0
          down vote













          You can do this programmatically. use editText.setEnabled(false) in your onStart() method of your activity (not in onCreate() - because this is some method for initializing GUI components)






          share|improve this answer





















          • This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
            – Michael Yaworski
            Jan 6 '16 at 19:41




















          up vote
          0
          down vote













          It is possible to use android:focusable="false" to disable it, but if that does not work for some reason, then you can simply put a LinearLayout and it will take the focus without disrupting your layout.



          NOTE: Eclipse will give you an error saying that your LinearLayout is useless because it has no contents. You should be able to disregard it with no problems.



          For example:



          <LinearLayout
          android:focusable="true"
          android:focusableInTouchMode="false"
          android:layout_width="0dp"
          android:layout_height="0dp"
          />
          <EditText
          android:id="@+id/password"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/changePass"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="167dp"
          android:ems="10"
          android:imeOptions="flagNoExtractUi"
          android:inputType="textPassword"
          android:maxLength="30" >
          </EditText>
          </LinearLayout>





          share|improve this answer






























            up vote
            0
            down vote













            <activity
            android:name=".MainActivity"
            android:windowSoftInputMode="stateAlwaysHidden" />



            android:windowSoftInputMode="stateAlwaysHidden"




            add this line in the activity tag of the Manifest.xml file.when you click on the TextEdit the keyboard gets into focus.






            share|improve this answer




























              up vote
              0
              down vote













              The easiest way is to add



              android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 


              in the activity tag of the Manifest.xml file






              share|improve this answer




























                up vote
                0
                down vote













                1) Its the simplest,open the manifest and put the following code between the activity tag:



                android:windowSoftInputMode="stateHidden"


                2) Put this attributes in the parent layout



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





                share|improve this answer




























                  up vote
                  0
                  down vote













                  In Manifest , copy and paste the beneath code.



                   <activity
                  android:name=".LoginActivity"
                  android:windowSoftInputMode="stateAlwaysHidden"/>





                  share|improve this answer




























                    up vote
                    -6
                    down vote













                    use android:focusable="false" for focusing disable



                    <EditText
                    android:id="@+id/password"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/changePass"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="167dp"
                    android:ems="10"
                    android:imeOptions="flagNoExtractUi"
                    android:inputType="textPassword"
                    android:maxLength="30"
                    android:focusable="false" >

                    </EditText>





                    share|improve this answer























                    • it works, but that makes it so it can never be focused on, even after touching.
                      – Michael Yaworski
                      Aug 18 '13 at 5:15










                    • you can use event listener when you need to make it focusable
                      – Mohammod Hossain
                      Aug 18 '13 at 5:18










                    • edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                      – Michael Yaworski
                      Aug 18 '13 at 5:21













                    Your Answer






                    StackExchange.ifUsing("editor", function () {
                    StackExchange.using("externalEditor", function () {
                    StackExchange.using("snippets", function () {
                    StackExchange.snippets.init();
                    });
                    });
                    }, "code-snippets");

                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "1"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                     

                    draft saved


                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18295802%2fhow-to-make-edittext-not-focused-when-creating-activity%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    13 Answers
                    13






                    active

                    oldest

                    votes








                    13 Answers
                    13






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes








                    up vote
                    270
                    down vote



                    accepted










                    You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"



                    Example:



                    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/mainLayout"
                    android:descendantFocusability="beforeDescendants"
                    android:focusableInTouchMode="true" >

                    <EditText
                    android:id="@+id/password"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/changePass"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="167dp"
                    android:ems="10"
                    android:imeOptions="flagNoExtractUi"
                    android:inputType="textPassword"
                    android:maxLength="30" >
                    </EditText>

                    </RelativeLayout>


                    May this one helpful ;)






                    share|improve this answer



























                      up vote
                      270
                      down vote



                      accepted










                      You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"



                      Example:



                      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                      android:id="@+id/mainLayout"
                      android:descendantFocusability="beforeDescendants"
                      android:focusableInTouchMode="true" >

                      <EditText
                      android:id="@+id/password"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@+id/changePass"
                      android:layout_centerHorizontal="true"
                      android:layout_marginTop="167dp"
                      android:ems="10"
                      android:imeOptions="flagNoExtractUi"
                      android:inputType="textPassword"
                      android:maxLength="30" >
                      </EditText>

                      </RelativeLayout>


                      May this one helpful ;)






                      share|improve this answer

























                        up vote
                        270
                        down vote



                        accepted







                        up vote
                        270
                        down vote



                        accepted






                        You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"



                        Example:



                        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/mainLayout"
                        android:descendantFocusability="beforeDescendants"
                        android:focusableInTouchMode="true" >

                        <EditText
                        android:id="@+id/password"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/changePass"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="167dp"
                        android:ems="10"
                        android:imeOptions="flagNoExtractUi"
                        android:inputType="textPassword"
                        android:maxLength="30" >
                        </EditText>

                        </RelativeLayout>


                        May this one helpful ;)






                        share|improve this answer














                        You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"



                        Example:



                        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/mainLayout"
                        android:descendantFocusability="beforeDescendants"
                        android:focusableInTouchMode="true" >

                        <EditText
                        android:id="@+id/password"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/changePass"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="167dp"
                        android:ems="10"
                        android:imeOptions="flagNoExtractUi"
                        android:inputType="textPassword"
                        android:maxLength="30" >
                        </EditText>

                        </RelativeLayout>


                        May this one helpful ;)







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Sep 28 '17 at 17:17









                        Adeel

                        2,06961424




                        2,06961424










                        answered Aug 18 '13 at 5:12









                        Pratik Butani

                        28.8k25142256




                        28.8k25142256
























                            up vote
                            16
                            down vote













                            XML code:



                            <EditText
                            android:id="@+id/password"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/changePass"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="167dp"
                            android:ems="10"
                            android:focusable="false"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="textPassword"
                            android:maxLength="30" >
                            </EditText>


                            Java code:



                            EditText edPwd = (EditText)findViewById(R.id.password);
                            edtPwd.setOnTouchListener(new View.OnTouchListener() {

                            @Override
                            public boolean onTouch(View v, MotionEvent event) {

                            v.setFocusable(true);
                            v.setFocusableInTouchMode(true);
                            return false;
                            }
                            });



                            set focusable false in xml and set it true via the code







                            share|improve this answer























                            • Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                              – Y.S.
                              Sep 3 '15 at 13:42










                            • I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                              – Syeda Zunairah
                              May 19 '16 at 11:57

















                            up vote
                            16
                            down vote













                            XML code:



                            <EditText
                            android:id="@+id/password"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/changePass"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="167dp"
                            android:ems="10"
                            android:focusable="false"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="textPassword"
                            android:maxLength="30" >
                            </EditText>


                            Java code:



                            EditText edPwd = (EditText)findViewById(R.id.password);
                            edtPwd.setOnTouchListener(new View.OnTouchListener() {

                            @Override
                            public boolean onTouch(View v, MotionEvent event) {

                            v.setFocusable(true);
                            v.setFocusableInTouchMode(true);
                            return false;
                            }
                            });



                            set focusable false in xml and set it true via the code







                            share|improve this answer























                            • Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                              – Y.S.
                              Sep 3 '15 at 13:42










                            • I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                              – Syeda Zunairah
                              May 19 '16 at 11:57















                            up vote
                            16
                            down vote










                            up vote
                            16
                            down vote









                            XML code:



                            <EditText
                            android:id="@+id/password"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/changePass"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="167dp"
                            android:ems="10"
                            android:focusable="false"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="textPassword"
                            android:maxLength="30" >
                            </EditText>


                            Java code:



                            EditText edPwd = (EditText)findViewById(R.id.password);
                            edtPwd.setOnTouchListener(new View.OnTouchListener() {

                            @Override
                            public boolean onTouch(View v, MotionEvent event) {

                            v.setFocusable(true);
                            v.setFocusableInTouchMode(true);
                            return false;
                            }
                            });



                            set focusable false in xml and set it true via the code







                            share|improve this answer














                            XML code:



                            <EditText
                            android:id="@+id/password"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/changePass"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="167dp"
                            android:ems="10"
                            android:focusable="false"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="textPassword"
                            android:maxLength="30" >
                            </EditText>


                            Java code:



                            EditText edPwd = (EditText)findViewById(R.id.password);
                            edtPwd.setOnTouchListener(new View.OnTouchListener() {

                            @Override
                            public boolean onTouch(View v, MotionEvent event) {

                            v.setFocusable(true);
                            v.setFocusableInTouchMode(true);
                            return false;
                            }
                            });



                            set focusable false in xml and set it true via the code








                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 8 '13 at 19:15









                            Michael Yaworski

                            9,304144779




                            9,304144779










                            answered Aug 18 '13 at 5:14









                            Meher

                            258111




                            258111












                            • Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                              – Y.S.
                              Sep 3 '15 at 13:42










                            • I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                              – Syeda Zunairah
                              May 19 '16 at 11:57




















                            • Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                              – Y.S.
                              Sep 3 '15 at 13:42










                            • I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                              – Syeda Zunairah
                              May 19 '16 at 11:57


















                            Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                            – Y.S.
                            Sep 3 '15 at 13:42




                            Good solution ... the answer marked correct results in the IME option actionNext failing completely.
                            – Y.S.
                            Sep 3 '15 at 13:42












                            I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                            – Syeda Zunairah
                            May 19 '16 at 11:57






                            I tried it first it didn't work, my bad I was testing on emulator with no touch screen, On real device its working like a charm, Thanks @Meher
                            – Syeda Zunairah
                            May 19 '16 at 11:57












                            up vote
                            12
                            down vote













                            In your main_layout
                            add this 2 lines:



                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"


                            example:



                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            xmlns:tools="http://schemas.android.com/tools"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"> *YOUR LAYOUT CODE* </RelativeLayout>





                            share|improve this answer

















                            • 1




                              Edit Text is not focused but the keyboard is visible.
                              – viper
                              Jan 3 '17 at 4:29















                            up vote
                            12
                            down vote













                            In your main_layout
                            add this 2 lines:



                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"


                            example:



                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            xmlns:tools="http://schemas.android.com/tools"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"> *YOUR LAYOUT CODE* </RelativeLayout>





                            share|improve this answer

















                            • 1




                              Edit Text is not focused but the keyboard is visible.
                              – viper
                              Jan 3 '17 at 4:29













                            up vote
                            12
                            down vote










                            up vote
                            12
                            down vote









                            In your main_layout
                            add this 2 lines:



                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"


                            example:



                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            xmlns:tools="http://schemas.android.com/tools"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"> *YOUR LAYOUT CODE* </RelativeLayout>





                            share|improve this answer












                            In your main_layout
                            add this 2 lines:



                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"


                            example:



                            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                            xmlns:app="http://schemas.android.com/apk/res-auto"
                            xmlns:tools="http://schemas.android.com/tools"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:descendantFocusability="beforeDescendants"
                            android:focusableInTouchMode="true"> *YOUR LAYOUT CODE* </RelativeLayout>






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 8 '16 at 9:21









                            avisper

                            35249




                            35249








                            • 1




                              Edit Text is not focused but the keyboard is visible.
                              – viper
                              Jan 3 '17 at 4:29














                            • 1




                              Edit Text is not focused but the keyboard is visible.
                              – viper
                              Jan 3 '17 at 4:29








                            1




                            1




                            Edit Text is not focused but the keyboard is visible.
                            – viper
                            Jan 3 '17 at 4:29




                            Edit Text is not focused but the keyboard is visible.
                            – viper
                            Jan 3 '17 at 4:29










                            up vote
                            2
                            down vote













                            Add this in onCreate()



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


                            or in onCreateView()



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





                            share|improve this answer

























                              up vote
                              2
                              down vote













                              Add this in onCreate()



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


                              or in onCreateView()



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





                              share|improve this answer























                                up vote
                                2
                                down vote










                                up vote
                                2
                                down vote









                                Add this in onCreate()



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


                                or in onCreateView()



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





                                share|improve this answer












                                Add this in onCreate()



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


                                or in onCreateView()



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






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Mar 16 '17 at 5:41









                                Sanket Parchande

                                488613




                                488613






















                                    up vote
                                    1
                                    down vote













                                    XML Code



                                    <EditText 
                                    android:imeOptions="flagNoExtractUi"
                                    android:focusable="false"
                                    />


                                    Java Code in onClickListerner



                                     mEdtEnterPhoneNumber.setFocusable(true);
                                    mEdtEnterPhoneNumber.setFocusableInTouchMode(true);





                                    share|improve this answer

























                                      up vote
                                      1
                                      down vote













                                      XML Code



                                      <EditText 
                                      android:imeOptions="flagNoExtractUi"
                                      android:focusable="false"
                                      />


                                      Java Code in onClickListerner



                                       mEdtEnterPhoneNumber.setFocusable(true);
                                      mEdtEnterPhoneNumber.setFocusableInTouchMode(true);





                                      share|improve this answer























                                        up vote
                                        1
                                        down vote










                                        up vote
                                        1
                                        down vote









                                        XML Code



                                        <EditText 
                                        android:imeOptions="flagNoExtractUi"
                                        android:focusable="false"
                                        />


                                        Java Code in onClickListerner



                                         mEdtEnterPhoneNumber.setFocusable(true);
                                        mEdtEnterPhoneNumber.setFocusableInTouchMode(true);





                                        share|improve this answer












                                        XML Code



                                        <EditText 
                                        android:imeOptions="flagNoExtractUi"
                                        android:focusable="false"
                                        />


                                        Java Code in onClickListerner



                                         mEdtEnterPhoneNumber.setFocusable(true);
                                        mEdtEnterPhoneNumber.setFocusableInTouchMode(true);






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jun 16 '16 at 3:24









                                        Hai Rom

                                        90187




                                        90187






















                                            up vote
                                            1
                                            down vote













                                            the best solution is here:
                                            https://stackoverflow.com/a/45139132/3172843



                                            the correct and simple solution is to setFocusable false and setFocusableInTouchMode true . so the EditText gain focus only when user touch that EditText



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





                                            share|improve this answer

























                                              up vote
                                              1
                                              down vote













                                              the best solution is here:
                                              https://stackoverflow.com/a/45139132/3172843



                                              the correct and simple solution is to setFocusable false and setFocusableInTouchMode true . so the EditText gain focus only when user touch that EditText



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





                                              share|improve this answer























                                                up vote
                                                1
                                                down vote










                                                up vote
                                                1
                                                down vote









                                                the best solution is here:
                                                https://stackoverflow.com/a/45139132/3172843



                                                the correct and simple solution is to setFocusable false and setFocusableInTouchMode true . so the EditText gain focus only when user touch that EditText



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





                                                share|improve this answer












                                                the best solution is here:
                                                https://stackoverflow.com/a/45139132/3172843



                                                the correct and simple solution is to setFocusable false and setFocusableInTouchMode true . so the EditText gain focus only when user touch that EditText



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






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jul 17 '17 at 8:18









                                                faraz khonsari

                                                1,043922




                                                1,043922






















                                                    up vote
                                                    0
                                                    down vote













                                                    You can do this programmatically. use editText.setEnabled(false) in your onStart() method of your activity (not in onCreate() - because this is some method for initializing GUI components)






                                                    share|improve this answer





















                                                    • This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                      – Michael Yaworski
                                                      Jan 6 '16 at 19:41

















                                                    up vote
                                                    0
                                                    down vote













                                                    You can do this programmatically. use editText.setEnabled(false) in your onStart() method of your activity (not in onCreate() - because this is some method for initializing GUI components)






                                                    share|improve this answer





















                                                    • This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                      – Michael Yaworski
                                                      Jan 6 '16 at 19:41















                                                    up vote
                                                    0
                                                    down vote










                                                    up vote
                                                    0
                                                    down vote









                                                    You can do this programmatically. use editText.setEnabled(false) in your onStart() method of your activity (not in onCreate() - because this is some method for initializing GUI components)






                                                    share|improve this answer












                                                    You can do this programmatically. use editText.setEnabled(false) in your onStart() method of your activity (not in onCreate() - because this is some method for initializing GUI components)







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Jan 6 '16 at 9:40









                                                    Nicole Conrad

                                                    172




                                                    172












                                                    • This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                      – Michael Yaworski
                                                      Jan 6 '16 at 19:41




















                                                    • This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                      – Michael Yaworski
                                                      Jan 6 '16 at 19:41


















                                                    This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                    – Michael Yaworski
                                                    Jan 6 '16 at 19:41






                                                    This would completely disable the EditText, which is not what is needed. I'm not sure (because I haven't tested), but I don't think disabling and then re-enabling would work either. Unless there's something I'm missing, make sure you understand the question.
                                                    – Michael Yaworski
                                                    Jan 6 '16 at 19:41












                                                    up vote
                                                    0
                                                    down vote













                                                    It is possible to use android:focusable="false" to disable it, but if that does not work for some reason, then you can simply put a LinearLayout and it will take the focus without disrupting your layout.



                                                    NOTE: Eclipse will give you an error saying that your LinearLayout is useless because it has no contents. You should be able to disregard it with no problems.



                                                    For example:



                                                    <LinearLayout
                                                    android:focusable="true"
                                                    android:focusableInTouchMode="false"
                                                    android:layout_width="0dp"
                                                    android:layout_height="0dp"
                                                    />
                                                    <EditText
                                                    android:id="@+id/password"
                                                    android:layout_width="wrap_content"
                                                    android:layout_height="wrap_content"
                                                    android:layout_below="@+id/changePass"
                                                    android:layout_centerHorizontal="true"
                                                    android:layout_marginTop="167dp"
                                                    android:ems="10"
                                                    android:imeOptions="flagNoExtractUi"
                                                    android:inputType="textPassword"
                                                    android:maxLength="30" >
                                                    </EditText>
                                                    </LinearLayout>





                                                    share|improve this answer



























                                                      up vote
                                                      0
                                                      down vote













                                                      It is possible to use android:focusable="false" to disable it, but if that does not work for some reason, then you can simply put a LinearLayout and it will take the focus without disrupting your layout.



                                                      NOTE: Eclipse will give you an error saying that your LinearLayout is useless because it has no contents. You should be able to disregard it with no problems.



                                                      For example:



                                                      <LinearLayout
                                                      android:focusable="true"
                                                      android:focusableInTouchMode="false"
                                                      android:layout_width="0dp"
                                                      android:layout_height="0dp"
                                                      />
                                                      <EditText
                                                      android:id="@+id/password"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:layout_below="@+id/changePass"
                                                      android:layout_centerHorizontal="true"
                                                      android:layout_marginTop="167dp"
                                                      android:ems="10"
                                                      android:imeOptions="flagNoExtractUi"
                                                      android:inputType="textPassword"
                                                      android:maxLength="30" >
                                                      </EditText>
                                                      </LinearLayout>





                                                      share|improve this answer

























                                                        up vote
                                                        0
                                                        down vote










                                                        up vote
                                                        0
                                                        down vote









                                                        It is possible to use android:focusable="false" to disable it, but if that does not work for some reason, then you can simply put a LinearLayout and it will take the focus without disrupting your layout.



                                                        NOTE: Eclipse will give you an error saying that your LinearLayout is useless because it has no contents. You should be able to disregard it with no problems.



                                                        For example:



                                                        <LinearLayout
                                                        android:focusable="true"
                                                        android:focusableInTouchMode="false"
                                                        android:layout_width="0dp"
                                                        android:layout_height="0dp"
                                                        />
                                                        <EditText
                                                        android:id="@+id/password"
                                                        android:layout_width="wrap_content"
                                                        android:layout_height="wrap_content"
                                                        android:layout_below="@+id/changePass"
                                                        android:layout_centerHorizontal="true"
                                                        android:layout_marginTop="167dp"
                                                        android:ems="10"
                                                        android:imeOptions="flagNoExtractUi"
                                                        android:inputType="textPassword"
                                                        android:maxLength="30" >
                                                        </EditText>
                                                        </LinearLayout>





                                                        share|improve this answer














                                                        It is possible to use android:focusable="false" to disable it, but if that does not work for some reason, then you can simply put a LinearLayout and it will take the focus without disrupting your layout.



                                                        NOTE: Eclipse will give you an error saying that your LinearLayout is useless because it has no contents. You should be able to disregard it with no problems.



                                                        For example:



                                                        <LinearLayout
                                                        android:focusable="true"
                                                        android:focusableInTouchMode="false"
                                                        android:layout_width="0dp"
                                                        android:layout_height="0dp"
                                                        />
                                                        <EditText
                                                        android:id="@+id/password"
                                                        android:layout_width="wrap_content"
                                                        android:layout_height="wrap_content"
                                                        android:layout_below="@+id/changePass"
                                                        android:layout_centerHorizontal="true"
                                                        android:layout_marginTop="167dp"
                                                        android:ems="10"
                                                        android:imeOptions="flagNoExtractUi"
                                                        android:inputType="textPassword"
                                                        android:maxLength="30" >
                                                        </EditText>
                                                        </LinearLayout>






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Oct 3 '16 at 9:05









                                                        Pratik Butani

                                                        28.8k25142256




                                                        28.8k25142256










                                                        answered Aug 18 '13 at 5:16









                                                        ThatGuyThere

                                                        1751921




                                                        1751921






















                                                            up vote
                                                            0
                                                            down vote













                                                            <activity
                                                            android:name=".MainActivity"
                                                            android:windowSoftInputMode="stateAlwaysHidden" />



                                                            android:windowSoftInputMode="stateAlwaysHidden"




                                                            add this line in the activity tag of the Manifest.xml file.when you click on the TextEdit the keyboard gets into focus.






                                                            share|improve this answer

























                                                              up vote
                                                              0
                                                              down vote













                                                              <activity
                                                              android:name=".MainActivity"
                                                              android:windowSoftInputMode="stateAlwaysHidden" />



                                                              android:windowSoftInputMode="stateAlwaysHidden"




                                                              add this line in the activity tag of the Manifest.xml file.when you click on the TextEdit the keyboard gets into focus.






                                                              share|improve this answer























                                                                up vote
                                                                0
                                                                down vote










                                                                up vote
                                                                0
                                                                down vote









                                                                <activity
                                                                android:name=".MainActivity"
                                                                android:windowSoftInputMode="stateAlwaysHidden" />



                                                                android:windowSoftInputMode="stateAlwaysHidden"




                                                                add this line in the activity tag of the Manifest.xml file.when you click on the TextEdit the keyboard gets into focus.






                                                                share|improve this answer












                                                                <activity
                                                                android:name=".MainActivity"
                                                                android:windowSoftInputMode="stateAlwaysHidden" />



                                                                android:windowSoftInputMode="stateAlwaysHidden"




                                                                add this line in the activity tag of the Manifest.xml file.when you click on the TextEdit the keyboard gets into focus.







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Oct 5 '17 at 7:26









                                                                pruthwiraj.kadam

                                                                18917




                                                                18917






















                                                                    up vote
                                                                    0
                                                                    down vote













                                                                    The easiest way is to add



                                                                    android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 


                                                                    in the activity tag of the Manifest.xml file






                                                                    share|improve this answer

























                                                                      up vote
                                                                      0
                                                                      down vote













                                                                      The easiest way is to add



                                                                      android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 


                                                                      in the activity tag of the Manifest.xml file






                                                                      share|improve this answer























                                                                        up vote
                                                                        0
                                                                        down vote










                                                                        up vote
                                                                        0
                                                                        down vote









                                                                        The easiest way is to add



                                                                        android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 


                                                                        in the activity tag of the Manifest.xml file






                                                                        share|improve this answer












                                                                        The easiest way is to add



                                                                        android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 


                                                                        in the activity tag of the Manifest.xml file







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered Feb 26 at 9:44









                                                                        Sudhir singh

                                                                        144210




                                                                        144210






















                                                                            up vote
                                                                            0
                                                                            down vote













                                                                            1) Its the simplest,open the manifest and put the following code between the activity tag:



                                                                            android:windowSoftInputMode="stateHidden"


                                                                            2) Put this attributes in the parent layout



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





                                                                            share|improve this answer

























                                                                              up vote
                                                                              0
                                                                              down vote













                                                                              1) Its the simplest,open the manifest and put the following code between the activity tag:



                                                                              android:windowSoftInputMode="stateHidden"


                                                                              2) Put this attributes in the parent layout



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





                                                                              share|improve this answer























                                                                                up vote
                                                                                0
                                                                                down vote










                                                                                up vote
                                                                                0
                                                                                down vote









                                                                                1) Its the simplest,open the manifest and put the following code between the activity tag:



                                                                                android:windowSoftInputMode="stateHidden"


                                                                                2) Put this attributes in the parent layout



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





                                                                                share|improve this answer












                                                                                1) Its the simplest,open the manifest and put the following code between the activity tag:



                                                                                android:windowSoftInputMode="stateHidden"


                                                                                2) Put this attributes in the parent layout



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






                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Sep 18 at 8:23









                                                                                Vincent Mungai

                                                                                6922




                                                                                6922






















                                                                                    up vote
                                                                                    0
                                                                                    down vote













                                                                                    In Manifest , copy and paste the beneath code.



                                                                                     <activity
                                                                                    android:name=".LoginActivity"
                                                                                    android:windowSoftInputMode="stateAlwaysHidden"/>





                                                                                    share|improve this answer

























                                                                                      up vote
                                                                                      0
                                                                                      down vote













                                                                                      In Manifest , copy and paste the beneath code.



                                                                                       <activity
                                                                                      android:name=".LoginActivity"
                                                                                      android:windowSoftInputMode="stateAlwaysHidden"/>





                                                                                      share|improve this answer























                                                                                        up vote
                                                                                        0
                                                                                        down vote










                                                                                        up vote
                                                                                        0
                                                                                        down vote









                                                                                        In Manifest , copy and paste the beneath code.



                                                                                         <activity
                                                                                        android:name=".LoginActivity"
                                                                                        android:windowSoftInputMode="stateAlwaysHidden"/>





                                                                                        share|improve this answer












                                                                                        In Manifest , copy and paste the beneath code.



                                                                                         <activity
                                                                                        android:name=".LoginActivity"
                                                                                        android:windowSoftInputMode="stateAlwaysHidden"/>






                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered Nov 9 at 7:57









                                                                                        Agilanbu

                                                                                        799617




                                                                                        799617






















                                                                                            up vote
                                                                                            -6
                                                                                            down vote













                                                                                            use android:focusable="false" for focusing disable



                                                                                            <EditText
                                                                                            android:id="@+id/password"
                                                                                            android:layout_width="wrap_content"
                                                                                            android:layout_height="wrap_content"
                                                                                            android:layout_below="@+id/changePass"
                                                                                            android:layout_centerHorizontal="true"
                                                                                            android:layout_marginTop="167dp"
                                                                                            android:ems="10"
                                                                                            android:imeOptions="flagNoExtractUi"
                                                                                            android:inputType="textPassword"
                                                                                            android:maxLength="30"
                                                                                            android:focusable="false" >

                                                                                            </EditText>





                                                                                            share|improve this answer























                                                                                            • it works, but that makes it so it can never be focused on, even after touching.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:15










                                                                                            • you can use event listener when you need to make it focusable
                                                                                              – Mohammod Hossain
                                                                                              Aug 18 '13 at 5:18










                                                                                            • edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:21

















                                                                                            up vote
                                                                                            -6
                                                                                            down vote













                                                                                            use android:focusable="false" for focusing disable



                                                                                            <EditText
                                                                                            android:id="@+id/password"
                                                                                            android:layout_width="wrap_content"
                                                                                            android:layout_height="wrap_content"
                                                                                            android:layout_below="@+id/changePass"
                                                                                            android:layout_centerHorizontal="true"
                                                                                            android:layout_marginTop="167dp"
                                                                                            android:ems="10"
                                                                                            android:imeOptions="flagNoExtractUi"
                                                                                            android:inputType="textPassword"
                                                                                            android:maxLength="30"
                                                                                            android:focusable="false" >

                                                                                            </EditText>





                                                                                            share|improve this answer























                                                                                            • it works, but that makes it so it can never be focused on, even after touching.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:15










                                                                                            • you can use event listener when you need to make it focusable
                                                                                              – Mohammod Hossain
                                                                                              Aug 18 '13 at 5:18










                                                                                            • edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:21















                                                                                            up vote
                                                                                            -6
                                                                                            down vote










                                                                                            up vote
                                                                                            -6
                                                                                            down vote









                                                                                            use android:focusable="false" for focusing disable



                                                                                            <EditText
                                                                                            android:id="@+id/password"
                                                                                            android:layout_width="wrap_content"
                                                                                            android:layout_height="wrap_content"
                                                                                            android:layout_below="@+id/changePass"
                                                                                            android:layout_centerHorizontal="true"
                                                                                            android:layout_marginTop="167dp"
                                                                                            android:ems="10"
                                                                                            android:imeOptions="flagNoExtractUi"
                                                                                            android:inputType="textPassword"
                                                                                            android:maxLength="30"
                                                                                            android:focusable="false" >

                                                                                            </EditText>





                                                                                            share|improve this answer














                                                                                            use android:focusable="false" for focusing disable



                                                                                            <EditText
                                                                                            android:id="@+id/password"
                                                                                            android:layout_width="wrap_content"
                                                                                            android:layout_height="wrap_content"
                                                                                            android:layout_below="@+id/changePass"
                                                                                            android:layout_centerHorizontal="true"
                                                                                            android:layout_marginTop="167dp"
                                                                                            android:ems="10"
                                                                                            android:imeOptions="flagNoExtractUi"
                                                                                            android:inputType="textPassword"
                                                                                            android:maxLength="30"
                                                                                            android:focusable="false" >

                                                                                            </EditText>






                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited Dec 8 '13 at 19:16









                                                                                            Michael Yaworski

                                                                                            9,304144779




                                                                                            9,304144779










                                                                                            answered Aug 18 '13 at 5:07









                                                                                            Mohammod Hossain

                                                                                            3,50921830




                                                                                            3,50921830












                                                                                            • it works, but that makes it so it can never be focused on, even after touching.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:15










                                                                                            • you can use event listener when you need to make it focusable
                                                                                              – Mohammod Hossain
                                                                                              Aug 18 '13 at 5:18










                                                                                            • edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:21




















                                                                                            • it works, but that makes it so it can never be focused on, even after touching.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:15










                                                                                            • you can use event listener when you need to make it focusable
                                                                                              – Mohammod Hossain
                                                                                              Aug 18 '13 at 5:18










                                                                                            • edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                              – Michael Yaworski
                                                                                              Aug 18 '13 at 5:21


















                                                                                            it works, but that makes it so it can never be focused on, even after touching.
                                                                                            – Michael Yaworski
                                                                                            Aug 18 '13 at 5:15




                                                                                            it works, but that makes it so it can never be focused on, even after touching.
                                                                                            – Michael Yaworski
                                                                                            Aug 18 '13 at 5:15












                                                                                            you can use event listener when you need to make it focusable
                                                                                            – Mohammod Hossain
                                                                                            Aug 18 '13 at 5:18




                                                                                            you can use event listener when you need to make it focusable
                                                                                            – Mohammod Hossain
                                                                                            Aug 18 '13 at 5:18












                                                                                            edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                            – Michael Yaworski
                                                                                            Aug 18 '13 at 5:21






                                                                                            edit your answer to have that, and I'll vote you up. Someone already answered with what you said, though.
                                                                                            – Michael Yaworski
                                                                                            Aug 18 '13 at 5:21




















                                                                                             

                                                                                            draft saved


                                                                                            draft discarded



















































                                                                                             


                                                                                            draft saved


                                                                                            draft discarded














                                                                                            StackExchange.ready(
                                                                                            function () {
                                                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18295802%2fhow-to-make-edittext-not-focused-when-creating-activity%23new-answer', 'question_page');
                                                                                            }
                                                                                            );

                                                                                            Post as a guest















                                                                                            Required, but never shown





















































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown

































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown







                                                                                            Popular posts from this blog

                                                                                            Landwehr

                                                                                            Reims

                                                                                            Schenkenzell