mercredi 6 mai 2015

Software keyboard move editTexts for android

I'm trying to get the editTexts, and sign in button to move up when the software keyboard is out however I want the background to not be compressed(I'm going to add an image soon). I have the TextView(Login), two EditTexts(email and password) and signin button in a ScrollView because I thought that might help however I have not be able to figure anything out.

http://ift.tt/1I34kpW

http://ift.tt/1I34kpW

This is the xml

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" >

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true"
            android:gravity="center"
            android:id="@+id/textLayout">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Login"
                android:id="@+id/loginView"
                android:textSize="22dp"
                android:layout_above="@+id/textLayout"
                android:layout_centerHorizontal="true" />

            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/emailTextfield"
                android:inputType="textEmailAddress"
                android:background="@android:drawable/edit_text"
                android:textColor="@android:color/primary_text_light"
                android:text="andresc1305@yahoo.com"
                android:hint="Email" />

            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="Password"
                android:text="Andres123"
                android:background="@android:drawable/edit_text"
                android:textColor="@android:color/primary_text_light"
                android:ems="10"
                android:id="@+id/passwordTextfield" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="SIGN IN"
                android:background="@android:color/transparent"
                android:textSize="24dp"
                android:id="@+id/signinButton"
                android:layout_below="@+id/textLayout"
                android:layout_centerHorizontal="true"
                android:onClick="onSigninClick"/>
        </LinearLayout>
    </ScrollView>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Forgot your password?"
        android:background="@android:color/transparent"
        android:textSize="14dp"
        android:id="@+id/forgotButton"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:onClick="onPasswordRecoverClick"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Register"
        android:background="@android:color/transparent"
        android:textSize="14dp"
        android:id="@+id/registerButton"
        android:layout_alignTop="@+id/forgotButton"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:onClick="onRegisterClick"/>


</RelativeLayout>

Aucun commentaire:

Enregistrer un commentaire