Thursday, December 18, 2014

Footer coming Top of the keyboard when Softkeyboard up in Android

I am working in android application want to use common header and footer. so i tried like this. when softkeyboard up the footer coming up the top of the softkeyboard.

<RelativeLayout 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="#fff">

    <!--  Header  Starts-->
    <LinearLayout android:id="@+id/header"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:background="@layout/header_gradient"
                  android:paddingTop="5dip"
                  android:paddingBottom="5dip">
        <!-- Logo Start-->
        <!--<ImageView android:src="@drawable/logo"-->
                   <!--android:layout_width="wrap_content"-->
                   <!--android:layout_height="wrap_content"-->
                   <!--android:layout_marginLeft="10dip"/>-->
        <!-- Logo Ends -->
    </LinearLayout>
    <!--  Header Ends -->
    <!-- Footer Start -->
    <LinearLayout android:id="@+id/footer"
                  android:layout_width="fill_parent"
                  android:layout_height="40dip"
                  android:background="@layout/footer_repeat"
                  android:layout_alignParentBottom="true">
    </LinearLayout>
    <!-- Footer Ends -->

    <!-- Login Form -->
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:layout_below="@id/header">
        <!--  Username Label -->
        <TextView android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:textColor="#372c24"
                  android:text="Username"/>
        <EditText android:id="@+id/reg_username"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="5dip"
                  android:singleLine="true"
                  android:layout_marginBottom="20dip"
                  android:textColor="#000"/>
        <!-- Password Label -->
        <TextView android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:textColor="#372c24"
                  android:text="Password"/>
        <EditText android:id="@+id/reg_password"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:password="true"
                  android:singleLine="true"
                  android:layout_marginTop="5dip"
                  android:textColor="#000"/>
        <!-- Login Button -->
        <Button android:id="@+id/buttonLogin"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dip"
                android:isScrollContainer="false"
                android:text="Login"/>

    </LinearLayout>
    <!-- Login Form Ends -->
</RelativeLayout>
</RelativeLayout>


Solution:

I found the solution just add one attribute in your activity tag in android manifest.xml like this

If you want more detail about this attribute, please reference this:

wsoft

<activity android:windowSoftInputMode="adjustPan" . . . >


No comments:

Post a Comment