Android: Keep TextInputEditText in view when typing
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
- Add
windowSoftInputMode="adjustPan"
to the relevantactivity
inAppManifest.xml
(I have also triedadjustResize
andadjustPan|adjustNothing
as according to other StackOverflow suggestions) - Place the
ConstraintLayout
inside aScrollView
- Add
android:isScrollContainer="false"
to said ScrollView - Recreate the layout file with only a
ConstraintLayout
andTextInputEditText
constrained to the bottom of said layout - Change
TextInputEditText
toEditText
and removeTextInputLayout
- Changed
ConstraintLayout
toRelativeLayout
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
|
show 4 more comments
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
- Add
windowSoftInputMode="adjustPan"
to the relevantactivity
inAppManifest.xml
(I have also triedadjustResize
andadjustPan|adjustNothing
as according to other StackOverflow suggestions) - Place the
ConstraintLayout
inside aScrollView
- Add
android:isScrollContainer="false"
to said ScrollView - Recreate the layout file with only a
ConstraintLayout
andTextInputEditText
constrained to the bottom of said layout - Change
TextInputEditText
toEditText
and removeTextInputLayout
- Changed
ConstraintLayout
toRelativeLayout
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
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
|
show 4 more comments
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
- Add
windowSoftInputMode="adjustPan"
to the relevantactivity
inAppManifest.xml
(I have also triedadjustResize
andadjustPan|adjustNothing
as according to other StackOverflow suggestions) - Place the
ConstraintLayout
inside aScrollView
- Add
android:isScrollContainer="false"
to said ScrollView - Recreate the layout file with only a
ConstraintLayout
andTextInputEditText
constrained to the bottom of said layout - Change
TextInputEditText
toEditText
and removeTextInputLayout
- Changed
ConstraintLayout
toRelativeLayout
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
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
- Add
windowSoftInputMode="adjustPan"
to the relevantactivity
inAppManifest.xml
(I have also triedadjustResize
andadjustPan|adjustNothing
as according to other StackOverflow suggestions) - Place the
ConstraintLayout
inside aScrollView
- Add
android:isScrollContainer="false"
to said ScrollView - Recreate the layout file with only a
ConstraintLayout
andTextInputEditText
constrained to the bottom of said layout - Change
TextInputEditText
toEditText
and removeTextInputLayout
- Changed
ConstraintLayout
toRelativeLayout
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
android xml android-layout mobile android-softkeyboard
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
|
show 4 more comments
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
|
show 4 more comments
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 13 '18 at 13:15
Tom BardenTom Barden
7918
7918
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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