Android: Keep TextInputEditText in view when typing












4















I'm attempting to create an activity with a couple of TextInputEditText elements. These are placed about half way down the page, causing them to be covered by the keyboard when it appears. As such, I'm trying to use windowSoftInputMode="adjustPan" inside the AppManifest.xml to have the screen scroll to keep the text boxes in view when typing.



However, all attempts at this seem to be failing. Below is the layout hierarchy I'm using, followed up some examples of solutions I've already attempted to no avail.



layout xml



<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:isScrollContainer="false">

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputA"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputAText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/inputB"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputBText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

</android.support.constraint.ConstraintLayout>

</ScrollView>


AndroidManifest.xml snippet



<activity
android:name=".activities.MyActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" />




Attempted Solutions




  1. Add windowSoftInputMode="adjustPan" to the relevant activity in AppManifest.xml (I have also tried adjustResize and adjustPan|adjustNothing as according to other StackOverflow suggestions)

  2. Place the ConstraintLayout inside a ScrollView

  3. Add android:isScrollContainer="false" to said ScrollView

  4. Recreate the layout file with only a ConstraintLayout and TextInputEditText constrained to the bottom of said layout

  5. Change TextInputEditText to EditText and remove TextInputLayout

  6. Changed ConstraintLayout to RelativeLayout


For what should be a fairly simple implementation I'm at a loss. Any further suggestions are appreciated. I'm happy to provide more code samples if necessary.










share|improve this question




















  • 1





    have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

    – Suresh
    Nov 13 '18 at 10:59











  • Alas, neither solution worked, thanks though!

    – Tom Barden
    Nov 13 '18 at 11:06











  • Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

    – Suresh
    Nov 13 '18 at 11:07











  • Sorry, they both did not work.

    – Tom Barden
    Nov 13 '18 at 11:08











  • Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

    – Suresh
    Nov 13 '18 at 11:11
















4















I'm attempting to create an activity with a couple of TextInputEditText elements. These are placed about half way down the page, causing them to be covered by the keyboard when it appears. As such, I'm trying to use windowSoftInputMode="adjustPan" inside the AppManifest.xml to have the screen scroll to keep the text boxes in view when typing.



However, all attempts at this seem to be failing. Below is the layout hierarchy I'm using, followed up some examples of solutions I've already attempted to no avail.



layout xml



<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:isScrollContainer="false">

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputA"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputAText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/inputB"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputBText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

</android.support.constraint.ConstraintLayout>

</ScrollView>


AndroidManifest.xml snippet



<activity
android:name=".activities.MyActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" />




Attempted Solutions




  1. Add windowSoftInputMode="adjustPan" to the relevant activity in AppManifest.xml (I have also tried adjustResize and adjustPan|adjustNothing as according to other StackOverflow suggestions)

  2. Place the ConstraintLayout inside a ScrollView

  3. Add android:isScrollContainer="false" to said ScrollView

  4. Recreate the layout file with only a ConstraintLayout and TextInputEditText constrained to the bottom of said layout

  5. Change TextInputEditText to EditText and remove TextInputLayout

  6. Changed ConstraintLayout to RelativeLayout


For what should be a fairly simple implementation I'm at a loss. Any further suggestions are appreciated. I'm happy to provide more code samples if necessary.










share|improve this question




















  • 1





    have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

    – Suresh
    Nov 13 '18 at 10:59











  • Alas, neither solution worked, thanks though!

    – Tom Barden
    Nov 13 '18 at 11:06











  • Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

    – Suresh
    Nov 13 '18 at 11:07











  • Sorry, they both did not work.

    – Tom Barden
    Nov 13 '18 at 11:08











  • Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

    – Suresh
    Nov 13 '18 at 11:11














4












4








4


3






I'm attempting to create an activity with a couple of TextInputEditText elements. These are placed about half way down the page, causing them to be covered by the keyboard when it appears. As such, I'm trying to use windowSoftInputMode="adjustPan" inside the AppManifest.xml to have the screen scroll to keep the text boxes in view when typing.



However, all attempts at this seem to be failing. Below is the layout hierarchy I'm using, followed up some examples of solutions I've already attempted to no avail.



layout xml



<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:isScrollContainer="false">

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputA"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputAText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/inputB"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputBText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

</android.support.constraint.ConstraintLayout>

</ScrollView>


AndroidManifest.xml snippet



<activity
android:name=".activities.MyActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" />




Attempted Solutions




  1. Add windowSoftInputMode="adjustPan" to the relevant activity in AppManifest.xml (I have also tried adjustResize and adjustPan|adjustNothing as according to other StackOverflow suggestions)

  2. Place the ConstraintLayout inside a ScrollView

  3. Add android:isScrollContainer="false" to said ScrollView

  4. Recreate the layout file with only a ConstraintLayout and TextInputEditText constrained to the bottom of said layout

  5. Change TextInputEditText to EditText and remove TextInputLayout

  6. Changed ConstraintLayout to RelativeLayout


For what should be a fairly simple implementation I'm at a loss. Any further suggestions are appreciated. I'm happy to provide more code samples if necessary.










share|improve this question
















I'm attempting to create an activity with a couple of TextInputEditText elements. These are placed about half way down the page, causing them to be covered by the keyboard when it appears. As such, I'm trying to use windowSoftInputMode="adjustPan" inside the AppManifest.xml to have the screen scroll to keep the text boxes in view when typing.



However, all attempts at this seem to be failing. Below is the layout hierarchy I'm using, followed up some examples of solutions I've already attempted to no avail.



layout xml



<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:isScrollContainer="false">

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputA"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputAText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/inputB"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputEditText
android:id="@+id/inputBText"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</android.support.design.widget.TextInputLayout>

</android.support.constraint.ConstraintLayout>

</ScrollView>


AndroidManifest.xml snippet



<activity
android:name=".activities.MyActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" />




Attempted Solutions




  1. Add windowSoftInputMode="adjustPan" to the relevant activity in AppManifest.xml (I have also tried adjustResize and adjustPan|adjustNothing as according to other StackOverflow suggestions)

  2. Place the ConstraintLayout inside a ScrollView

  3. Add android:isScrollContainer="false" to said ScrollView

  4. Recreate the layout file with only a ConstraintLayout and TextInputEditText constrained to the bottom of said layout

  5. Change TextInputEditText to EditText and remove TextInputLayout

  6. Changed ConstraintLayout to RelativeLayout


For what should be a fairly simple implementation I'm at a loss. Any further suggestions are appreciated. I'm happy to provide more code samples if necessary.







android xml android-layout mobile android-softkeyboard






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 11:07







Tom Barden

















asked Nov 12 '18 at 17:39









Tom BardenTom Barden

7918




7918








  • 1





    have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

    – Suresh
    Nov 13 '18 at 10:59











  • Alas, neither solution worked, thanks though!

    – Tom Barden
    Nov 13 '18 at 11:06











  • Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

    – Suresh
    Nov 13 '18 at 11:07











  • Sorry, they both did not work.

    – Tom Barden
    Nov 13 '18 at 11:08











  • Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

    – Suresh
    Nov 13 '18 at 11:11














  • 1





    have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

    – Suresh
    Nov 13 '18 at 10:59











  • Alas, neither solution worked, thanks though!

    – Tom Barden
    Nov 13 '18 at 11:06











  • Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

    – Suresh
    Nov 13 '18 at 11:07











  • Sorry, they both did not work.

    – Tom Barden
    Nov 13 '18 at 11:08











  • Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

    – Suresh
    Nov 13 '18 at 11:11








1




1





have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

– Suresh
Nov 13 '18 at 10:59





have you tried with out the scroll view?. have only constrain layout. In worst case try relative layout instead of constrain layout.... may or may not work

– Suresh
Nov 13 '18 at 10:59













Alas, neither solution worked, thanks though!

– Tom Barden
Nov 13 '18 at 11:06





Alas, neither solution worked, thanks though!

– Tom Barden
Nov 13 '18 at 11:06













Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

– Suresh
Nov 13 '18 at 11:07





Didn't get you. (My poor English ). Can i know what you are trying to say? Which one got worked?

– Suresh
Nov 13 '18 at 11:07













Sorry, they both did not work.

– Tom Barden
Nov 13 '18 at 11:08





Sorry, they both did not work.

– Tom Barden
Nov 13 '18 at 11:08













Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

– Suresh
Nov 13 '18 at 11:11





Have you tried without android:windowSoftInputMode="adjustPan" line in manifest. I think by default it will make the view up. Are you using real device to test or emulator ?

– Suresh
Nov 13 '18 at 11:11












1 Answer
1






active

oldest

votes


















2














Found the problem! In my theme I declared <item name="android:windowTranslucentStatus">true</item>. For some reason, this breaks windowSoftInputMode="adjustPan", and as such I removed it.



In order to keep the status bar transparent, I use <item name="android:statusBarColor">@color/transparent</item>.



Hopefully someone, someday finds this useful.






share|improve this answer























    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',
    autoActivateHeartbeat: false,
    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%2f53267380%2fandroid-keep-textinputedittext-in-view-when-typing%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Found the problem! In my theme I declared <item name="android:windowTranslucentStatus">true</item>. For some reason, this breaks windowSoftInputMode="adjustPan", and as such I removed it.



    In order to keep the status bar transparent, I use <item name="android:statusBarColor">@color/transparent</item>.



    Hopefully someone, someday finds this useful.






    share|improve this answer




























      2














      Found the problem! In my theme I declared <item name="android:windowTranslucentStatus">true</item>. For some reason, this breaks windowSoftInputMode="adjustPan", and as such I removed it.



      In order to keep the status bar transparent, I use <item name="android:statusBarColor">@color/transparent</item>.



      Hopefully someone, someday finds this useful.






      share|improve this answer


























        2












        2








        2







        Found the problem! In my theme I declared <item name="android:windowTranslucentStatus">true</item>. For some reason, this breaks windowSoftInputMode="adjustPan", and as such I removed it.



        In order to keep the status bar transparent, I use <item name="android:statusBarColor">@color/transparent</item>.



        Hopefully someone, someday finds this useful.






        share|improve this answer













        Found the problem! In my theme I declared <item name="android:windowTranslucentStatus">true</item>. For some reason, this breaks windowSoftInputMode="adjustPan", and as such I removed it.



        In order to keep the status bar transparent, I use <item name="android:statusBarColor">@color/transparent</item>.



        Hopefully someone, someday finds this useful.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 13:15









        Tom BardenTom Barden

        7918




        7918






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267380%2fandroid-keep-textinputedittext-in-view-when-typing%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

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma