I have a login screen in the first activity of my android application. When the user selects the password field after filling in the username field the virtual on screen keyboard pops up and blocks the password field. The user is unable to view what they are typing. How can I solve this problem?
Below is my main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout style="@style/LoginScreen" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff"
>
<ListView android:id="@+id/listView1" android:layout_height="wrap_content" android:layout_width="match_parent"></ListView>
<ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/logo"></ImageView>
<TextView android:textColor="#000" android:layout_width="wrap_content" android:id="@+id/textView1" android:layout_height="wrap_content" android:text="Enter your Google Account credentials:"></TextView>
<TextView style="@style/LoginLabel" android:layout_width="wrap_content" android:id="@+id/textView1" android:layout_height="wrap_content" android:text="Username:"></TextView>
<EditText android:layout_width="match_parent" android:id="@+id/login_username" android:layout_height="wrap_content"></EditText>
<TextView style="@style/LoginLabel" android:layout_width="wrap_content" android:id="@+id/textView2" android:layout_height="wrap_content" android:text="Password:"></TextView>
<EditText android:id="@+id/login_password" android:layout_height="wrap_content" android:layout_width="match_parent" android:password="true"></EditText>
<Button style="@style/LoginButton" android:id="@+id/login_button" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="Login"></Button>
<LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_width="match_parent">
</LinearLayout>
In your manifest you can define how you want the soft keyboard to modify your layout, e.g:
That will resize your components to “best fit”. You can also use
adjustPan, in that case the visible area will move around to focus on your textbox.See this.