I have a rather simple login page in my Android app, containing a header, username TextView, password TextView, Login button and an image footer:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff" >
<!-- Header Starts -->
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
>
<!-- Logo Start -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:src="@drawable/header" />
<!-- Logo Ends -->
</LinearLayout>
<!-- Header Ends -->
<!-- Footer Start -->
<LinearLayout android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="90dip"
android:layout_alignParentBottom="true"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:src="@drawable/footer" />
</LinearLayout>
<!-- Footer Ends -->
<!-- Login Form -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip"
android:layout_below="@+id/header"
>
<!-- Application Name Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:gravity="center"
android:padding="10dip"
android:textSize="25dp"
android:textStyle="bold"
/>
<!-- Username Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="#372c24" />
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:singleLine="true" />
<!-- Password Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password"
android:textColor="#372c24" />
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:password="true"
android:singleLine="true" />
<!-- Login button -->
<Button
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Logon" />
</LinearLayout>
<!-- Login Form Ends -->
</RelativeLayout>
</ScrollView>
I have two problems I think are related:
The things I've tried:
android:windowSoftInputMode="adjustPan"
, but I want to be able to scroll down when the keyboard appears, or android:windowSoftInputMode="adjustResize"
, or any other param for that matter.marginBottom
in the button. Neither worked. I would appreciate any help.
Open your manifest.xml file .change in your activity tab .
<activity
android:configChanges="keyboardHidden|orientation"
android:name=".testActivity"
android:label="@string/app_name"></activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With