How to make background push up when click EditText

2019-08-17 18:32发布

问题:

I am try to make my login page like facebook login. everything done but one thing that not yet done is when I click the Email the keyboard was cover my Password so I can't type my password. how to make my Email Password Signin button push up when click in Email? this is my xml.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <LinearLayout
        style="@style/bg_layout"
        android:layout_width="match_parent"
        android:layout_height="533dp"
        android:orientation="vertical"
        android:weightSum="2" >

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="41dp"
            android:background="@drawable/navbar_stay"
            android:paddingRight="5dp" >

            <ImageButton
                android:id="@+id/imageButton1"
                style="@style/st_close"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:src="@drawable/click_close" />

            <ImageView
                android:id="@+id/btn_upload"
                style="@style/st_upload"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_alignParentRight="true"
                android:layout_alignTop="@+id/imageButton1"
                android:src="@drawable/click_upload" />
        </RelativeLayout>

        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#00000000"
            android:ems="10"
            android:focusable="false"
            android:hint="What are you doing here"
            android:paddingLeft="10dp" >

            <requestFocus />
        </EditText>

        <Space
            android:layout_width="match_parent"
            android:layout_height="200dp" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingRight="5dp" >

            <ImageView
                android:id="@+id/im_upload"
                android:layout_width="80dp"
                android:layout_height="60dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:paddingRight="5dp"
                android:scaleType="fitXY"
                android:src="@drawable/card_base" />

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/im_upload"
                android:layout_toRightOf="@+id/im_upload"
                android:background="@drawable/fillbox_place"
                android:orientation="vertical" >

                <EditText
                    android:id="@+id/editText2"
                    android:layout_width="197dp"
                    android:layout_height="40dp"
                    android:layout_gravity="right"
                    android:background="#00000000"
                    android:ems="10"
                    android:hint="What is the name of this place?"
                    android:textSize="12sp" />
            </LinearLayout>

            <DigitalClock
                android:id="@+id/digitalClock1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/linearLayout1"
                android:layout_alignLeft="@+id/linearLayout1"
                android:text="DigitalClock" />
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>

</ScrollView>

回答1:

Try by setting the height of the scroll view