0

I have the following activity as rendered from a 320 x 480 low-density screen (don't mind the black strip on the right, it's a problem with the screen capture).

enter image description here

The EditTexts are enclosed in a ScrollView--there's six of them, actually. The sign up button shares a LinearLayout with the ScrollView via weight measurement, while everything else is positioned via a RelativeLayout. When I tap on the "E-mail" text field (the fourth one), this is what shows:

enter image description here

My question is, how can I make the parent RelativeLayout move up and not just the ScrollView to make the e-mail text field more visible? Also, the hint of the sign-up button there is quite ugly. Is there any way I can avoid that? Here's the XML code for the layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_320x480">

    <TextView android:id="@+id/signup_logo_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#0a6698"
        android:textColor="#ff7f00"
        android:text="Blackened App Name"
        android:textStyle="bold"
        android:textSize="10pt"
        android:gravity="center"
        android:padding="8dp"
        />

    <ImageView android:id="@+id/signup_icons_ghost_img"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/icons_ghost_320x112"
        android:layout_below="@id/signup_logo_txt"
        android:contentDescription="lalalala"
        android:layout_marginTop="-21dp"
        />

    <TextView android:id="@+id/signup_tagline_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="The easiest way to find a mobile plan that best suits how you use your phone."
        android:textColor="#000"
        android:textSize="5pt"
        android:gravity="center"
        android:layout_below="@id/signup_logo_txt"
        android:layout_marginTop="10dp"
        />

    <TextView android:id="@+id/signup_getstarted_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Sign up and let's get started!"
        android:textColor="#0a6998"
        android:textSize="6pt"
        android:textStyle="bold"
        android:gravity="center"
        android:layout_below="@id/signup_tagline_txt"
        android:layout_marginTop="6dp"
        />

    <LinearLayout android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="1.0"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_below="@id/signup_getstarted_txt"
        >
        <ScrollView android:id="@+id/signup_fields_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight=".8">
            <LinearLayout android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                >
                <EditText android:id="@+id/signup_name_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="Navn"
                    android:layout_marginTop="5dp"
                    />

                <EditText android:id="@+id/signup_carrier_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="Nuvaerende mobilselskab"
                    android:layout_marginTop="3dp"
                    />

                <EditText android:id="@+id/signup_plan_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="Mobilforbrug i kroner"
                    android:layout_marginTop="3dp"
                    />

                <EditText android:id="@+id/signup_email_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="E-mail"
                    android:layout_marginTop="3dp"
                    />

                <EditText android:id="@+id/signup_verify_email_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="Bekraeft e-mail"
                    android:layout_marginTop="3dp"
                    />

                <EditText android:id="@+id/signup_mobile_number_fld"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:hint="Mobilnummer"
                    android:layout_marginTop="3dp"
                    />
            </LinearLayout>
        </ScrollView>

        <Button android:id="@+id/signup_signup_btn"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight=".2"
            android:text="SIGN UP"
            android:textColor="#fff"
            android:layout_gravity="center"
            android:layout_marginBottom="8dp"
            />
    </LinearLayout>

</RelativeLayout>
4

1 回答 1

1

android:windowSoftInputMode="adjustPan"我的事情你没有设置在清单文件的活动中调整 pan.set

于 2012-10-12T11:01:03.580 回答