Reputation: 10589
I have four EditText's in my Scrollview together with some checkbox and button:
password
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<EditText
android:id="@+id/register_textedit_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:ellipsize="end"
android:hint="@string/text_firstname"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true" />
<EditText
android:id="@+id/register_textedit_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:ellipsize="end"
android:hint="@string/text_lastname"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true" />
<EditText
android:id="@+id/register_textedit_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:ellipsize="end"
android:hint="@string/text_email"
android:inputType="textEmailAddress"
android:lines="1"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true" />
<EditText
android:id="@+id/register_textedit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:ellipsize="end"
android:hint="@string/text_password"
android:inputType="textPassword"
android:lines="1"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true" />
<CheckBox
android:id="@+id/register_checkbox_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/checkbox_showpassword" />
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/register_button_register"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_register" />
<Button
android:id="@+id/register_button_cancel"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_cancel" />
</LinearLayout>
</LinearLayout>
</ScrollView>
The manifest for this activity:
<activity
android:name="de.hof.ime_dc.idia_move.activities.RegisterActivity"
android:label="@string/title_activity_register"
android:launchMode="singleTask" >
</activity>
When i focus firstname or lastname the EditText for firstname gets pushed out of the top screen. I cant see it but i can type in it. when i focus email or password the firstname EditText comes back into the screen. I cant understand this behavoiur because when the firstname EditText gets pushed out of screen i cant scroll up to it (They are all in a ScrollView).
Dont get me wrong, i want my views to be pushed up when keyboard appears but i dont want them to get pushed out of the screen without being able to scroll to them.
EDIT
Just an idea:
Maybe it is because of my Action Title Bar? On every screen i have a action title bar with a navigation drawer. its seems that the edittext gets pushed under the title bar. Could that be?
EDIT 2
I noticed that it just happens on android device with android version 5.0. A bug?
Upvotes: 1
Views: 760
Reputation: 10589
The problem was, that i added this to my layouts:
android:layout_gravity="center"
That was the root of the evil.
Upvotes: 2
Reputation: 75788
Just add this in your Manifest
.It works for me
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
I checked this .Please add this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
For more information you can see this LINK
Upvotes: 3
Reputation: 820
You can add "adjustResize" to your Manifest file to resolve such kind of bug -
<application ... >
<activity
android:windowSoftInputMode="adjustResize" ... >
...
</activity>
...
</application>
Hope this helps you :)
Upvotes: 1