How to have a layout adaptable to all screens? [duplicate]

0

I wanted more or less this formatting, but when I fill the last editext, it goes up on the keyboard and everything goes out of order.

  <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin">


    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/cadastro"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

    <EditText
        android:id="@+id/editText4"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/textView6"
        android:text="@string/edtnome" />

    <EditText
        android:id="@+id/editText5"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/edtendereco"
        android:layout_below="@+id/textView8"
        android:layout_alignEnd="@+id/radioGroup2" />

    <EditText
        android:id="@+id/editText6"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textMultiLine"
        android:text="@string/edtDescricao"
        android:layout_above="@+id/button2"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="60dp" />

    <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/editText5"
        android:layout_below="@+id/editText4"
        android:layout_toEndOf="@+id/textView6" >

        <RadioButton
            android:id="@+id/radioButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:checked="false"
            android:text="Tem vaga" />

        <RadioButton
            android:id="@+id/radioButton7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="New RadioButton" />
    </RadioGroup>

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:text="@string/lblnome"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText4"
        android:layout_centerHorizontal="true"
        android:text="@string/lblcategoria"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView8"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/textView7"
        android:layout_marginTop="34dp"
        android:text="@string/lblendereco"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView9"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/lbldesc"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_above="@+id/editText6"
        android:layout_alignParentEnd="true" />

    <TextView
        android:id="@+id/textView10"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/editText5"
        android:text="@string/lbltipo"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <RadioGroup
        android:id="@+id/radioGroup2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_alignStart="@+id/radioGroup"
        android:layout_alignTop="@+id/textView10"
        android:layout_above="@+id/textView9" >

        <RadioButton
            android:id="@+id/radioButton8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="Masculina" />

        <RadioButton
            android:id="@+id/radioButton9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="Feminina" />

        <RadioButton
            android:id="@+id/radioButton10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="Unissex" />
    </RadioGroup>
</RelativeLayout>
    
asked by anonymous 20.06.2016 / 13:00

1 answer

0

You can add the following code in the AndroidManifest in the Activity in question

<activity android:windowSoftInputMode="adjustResize"> </activity>

So activity always reorganizes to make room for the keyboard

    
21.06.2016 / 19:50