Android : Showing keyboard hides listview contents - android

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

Related

Android. Adjust resize not working on specific devices

I have an activity with windowSoftInputMode="adjustResize".
Everything works as expected for adjustResize mode. However, on some specific devices, after the keyboard is closed, there is an empty space on the screen from the keyboard. It looks like the screen couldn't be resize.
I found similar problems. But setting the adjustPan mode doesn't suit me.
I also tried to set the fitsSystemWindows="true" for my root view. It did not help.
My layout structure is:
<RelativeLayout>
<ScrollView>
<LinearLayout>
....
</LinearLayout>
</ScrollView>
<RelativeLayout>
For the Scroll View, I set the attribute fillViewport="true"
Please, help me)
Try adding the following attribute values to your activity tag in manifest
android:configChanges="orientation|keyboardHidden|screenSize"

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"/>

Scroll edittext in a scrollview to the top of the screen

I have a below type structure,
<LinearLayout>
<ScrollView>
<LinearLayout>
<EditText1>
<EditText2>
<EditText3>
<EditText4>
<EditText5>
<EditText6>
<.......>
<.......>
<.......>
</LinearLayout>
</ScrollView>
My problem is when I select any of the EditText, the ScrollView should scroll in such a way that the selected EditText should be moved on to the top of the screen just after the action bar, and below the selected EditText the soft-keyboard should open.
Please give me some suggestions to accomplish this.
Regards,
open your manifest file of your project locate the activity in which you want the behavior you are looking for and write this as it's attribute
android:windowSoftInputMode="stateHidden|adjustPan"
Example
<activity
android:name=".SOMEActivity"
android:label="#string/some_title"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustPan" />
you can try different values for "windowSoftInputMode" attribute to see what exactly you want.

Soft keyboard hide EditText in lollipop version

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>

Spinner is cutting off dropdown list when showing keyboard

I have a Spinner as:
<Spinner
android:id="#+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
It's inside a activity displayed as a dialog (I don't know if it matters, but...) <activity android:theme="#android:style/Theme.Holo.Light.Dialog" ... />
It works fine, showing all the five itens.
Until the keyboard I open the keyboard. Now, the first item is cut and cannot be scrolled to it.
I tried to put a listener for click in this spinner and close the keyboard, but I got an error java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
What is the fix for this behavior?
You probably need to change the soft input mode for the activity in your manifest file. Something like this:
<activity android:windowSoftInputMode="adjustResize" ... >

Categories

Resources