Soft keyboard hide EditText in lollipop version - android

I have a layout which contain RelativeLayout as Root layout,Relative layoout contain ListView at Top and one Edittext align at the bottom of relative layout.
In Pre lollipop version devices whenever soft keyboard open Edittext pushed up and I am able to see the Editext.
But in lollipop soft keyboard hide the Editext.
I have already set android:windowSoftInputMode="adjustPan|adjustResize" in manifest file.
Please help me

try to give fitsSystemWindows in your main layout( for lollipop versions)
android:fitsSystemWindows="true"
also in the manifest give
android:windowSoftInputMode="adjustResize"
hope this will help

Thanks for your valuable input. Finally I have fixed this issue.
What I found the reason behind this issue is application theme. My application theme was
android:Theme.Light in which I found this issue. I have only changed the theme of my EditText layout activity by setting
android:theme="#android:style/Theme.Black.NoTitleBar"
e.g.
<activity
android:name=".activity.LiveStreamingActivity"
android:label="#string/title_activity_event_performer"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:screenOrientation="portrait" />
This solved my problem !!!

May be your activity is full screen. Try clearing the FULLSCREEN flag.

I too had the same issue and it was because of the usage of a menudrawer library which was not supported by lollipop and when I replace that with default navigation drawer of android the things started working fine.Please check with the libraries if you use any.

The important value is the adjustResize. This will shift the whole UI up to give room for the soft keyboard.
<activity
android:name="com.my.MainActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_main"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>

Related

Keyboard covers Exidtext field [duplicate]

This question already has answers here:
How to adjust layout when soft keyboard appears
(18 answers)
Closed 5 years ago.
The Edittext field is covered with the current keyboard.
People don't see what they are typing at the moment. The page is a fragment.
Here is a XML layout of the mentioned Edittext:
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/commentEditText"
android:windowSoftInputMode="adjustPan"
android:hint="Opmerkingen" />
It doesn't work. Maybe I'm doing it the wrong way. Can you help me to solve it?
https://i.stack.imgur.com/XmuXm.png
use android:windowSoftInputMode=adjustPan in mainfiest file inside activity
use like this see example
<activity
android:name=".activity"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden">
</activity>
You can try using android:windowSoftInputMode="adjustResize" in your activity's manifest file, which will resize your screen to fit keyboard.
If user still cannot see input on EditText you can try android:windowSoftInputMode="adjustPan", which does not resize screen to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.
Add this line to your activity tag in Menifest file,
<activity
android:name=".LoginActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"/>

Android soft keyboard pushing views

i'm developing a soft keyboard for an android and I faced a problem which I could not solve. The problem is that when I open a keyboard it moves other views incorrectly (see the picture, my keyboard on the left).
I have tried multiple solutions that I found on stackoverflow or somewhere else, but they didn't work for me.
I've tried:
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="stateHidden|adjustPan"
android:windowSoftInputMode="adjustResize|stateVisible|stateAlwaysHidden"
but it didn't change the behavior you see on the screenshot.
So, please help me to solve this problem.
Ps. I know that there are many similar questions where "adjustResize" or "stateHidden|adjustPan" is offered, but it doesn't work for me.
P.p.s screenshot is taken in android 6.0.1.
Thanks.
I finally found an answer to my question. You need to use this code in your class that extends InputMethodService:
#Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
if (!isFullscreenMode()) {
outInsets.contentTopInsets = outInsets.visibleTopInsets;
}
}
You can simply switch your activity's windowSoftInputMode flag to "adjustPan". Remove adjustResize.
<activity
...
android:windowSoftInputMode="adjustPan">
</activity>
Try to wrap your layout with scrollView
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
.
.
.
.
</ScrollView>
I think the android:windowSoftInputMode can work, but like this:
android:windowSoftInputMode="adjustNothing"
Try it.

Android : Showing keyboard hides listview contents

like in this post : Keyboard hides ListView contents
I can't See Contents of my first few rows of my ListView when Keyboard is Visible.
Because my first probleme was to have my element in the bottom so i've follow this tips : Android : Showing keyboard moves my components up, i want to hide them instead
but
android:windowSoftInputMode="adjustPan"
created another issue, my listview is not resize when my keyboard is up and i can't see my first few rows
Thanks
I had the same issue and solved this with the below code.
in your activity:
mylistview.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
mylistview.setStackFromBottom(true);
or in xml file for
android:stackFromBottom="true"
android:transcriptMode="normal"
and keeping the adjustResize for activity in manifest file.
<activity .... android:windowSoftInputMode="stateHidden|adjustResize" ..../>
Source: Push Listview when keyboard appears without adjustPan

Keyboard covers up part of edittext

I have a numberpicker but my keyboard is not showing up like I want.
Screen:
As you can see, the keyboard covers part of the edittext.
How can I fix this without using a scrollview?
I've already tried setting android:windowSoftInputMode="adjustPan" or "adjustResize".
When I use scrollview I get the following problem :
Screen shifts a bit when change focus to next edittext
Thx :)
in manifest file set activity attribute
android:windowSoftInputMode="adjustResize|stateHidden"
like :
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustResize|stateHidden" >
it should work

Adjust scrollview when keyboard is up

I have an activity with a form in it. Because the form is quite long, I've used a scrollview.
The problem is that the scrollview doesn't change when the keyboard is up. The keyboard overlaps the last part of the scrollview.
How can I make sure that the keyboard is below the scrollview and the scrollview is adjusted to fit the space above it?
In the meanwhile, is there a way to make sure the buttons ‘previous’ and ‘next’ are in the keyboard as well?
In the application's manifest file, add the following to the desired <activity /> --
android:windowSoftInputMode="stateAlwaysHidden|adjustResize|adjustPan"
You need to add android:windowSoftInputMode="adjustResize" in the AndroidManifest.xml file.
if you use fragment, you just need to use the code to control it, like below
context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
For ScrollView, I like to use the following soft input mode for the Activity in the AndroidManifest.xml file:
android:windowSoftInputMode="adjustPan"
This works the best for me out of the other options.
Note, if you are using CoordinatorLayout, make sure you set android:fitsSystemWindows="false" to be able to make it work for "adjustResize"
The above answers are not enough!
See this article
https://code.luasoftware.com/tutorials/android/move-layout-when-keyboard-shown/
<ScrollView ... android:layout_height="fill_parent" android:fillViewport="true" android:fitsSystemWindows="true" />
Manifest
<activity ... android:windowSoftInputMode="stateHidden|adjustResize" />
it's work for me

Categories

Resources