mercredi 6 mai 2015

Modifying login Page design to make login button always visible

I have the following layout for login page,i need to reduce the spacing between each element,in short i need to move username,password and login button upwards of the screen ,that is when we open virtual keyboard the login button should be visible always,i tried using 'margintop=-negative value',its not working out.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:andriod="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/loginbackmain"
    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/ic_launcher" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:gravity="top"
        android:orientation="vertical" >
       <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:gravity="top"
        android:background="@drawable/loginformback"
        android:orientation="vertical"
        android:weightSum="1">

          <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <EditText
                android:id="@+id/editText1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="15dp"
                android:layout_weight="1"
                android:drawableLeft="@android:drawable/ic_menu_day"
                android:ems="10"
                android:hint="username" >

                <requestFocus />
            </EditText>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="-30dp">

            <EditText
                android:id="@+id/editText2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="15dp"
                android:drawableLeft="@android:drawable/ic_menu_day"
                android:ems="10"
                android:hint="password"
                android:inputType="textPassword" />
        </LinearLayout>


        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="5dp"
            android:onClick="login"
            android:text="Login"
            andriod:background="#A0522D"/>
           <ProgressBar
               android:id="@+id/progressBar1"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_gravity="center_horizontal"
               android:visibility="invisible"
               />

       </LinearLayout>
</LinearLayout>
</LinearLayout>

Aucun commentaire:

Enregistrer un commentaire