简体   繁体   中英

How to create layout for registration mobile number

http://snag.gy/0kz5e.jpg please look this Image I have to create layout but I am unable to do this there is some Problem with android control set on particular.

I am able to display controls in android:gravity bottom but my controls is not fix like image please check what I am missing where am doing wrong . here is my Xml file code:

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="132dp"
        android:layout_gravity="bottom"
        android:orientation="vertical" >

        <Spinner
            android:id="@+id/spinner1"
            android:layout_width="match_parent"
            android:layout_height="49dp"
            android:entries="@array/country_arrays"
            android:prompt="@string/country_prompt" />

        <LinearLayout
            android:id="@+id/layout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <EditText
                android:id="@+id/editText1"
                android:layout_width="94dp"
                android:layout_height="wrap_content"
                android:ems="10"
                android:inputType="number"
                android:text="Code" >

                <requestFocus />
            </EditText>

            <EditText
                android:id="@+id/editText2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="phone"
                android:text="Phone" />
        </LinearLayout>

        <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout1"
            android:text="Next"
            android:textColor="#0066FF"
            android:textStyle="bold" />
    </LinearLayout>

</FrameLayout>

Can you just try below code, I replace FrameLayout to RelativeLayout:

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_margin="10dp"
    android:background="@android:color/transparent"
    android:orientation="vertical" >

    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:id="@+id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText1"
            android:layout_width="94dp"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="number"
            android:text="Code" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="phone"
            android:text="Phone" />
    </LinearLayout>

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="Next"
        android:textColor="#0066FF"
        android:textStyle="bold" />
</LinearLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM