How to have a layout adaptable to all screens?

Asked

Viewed 73 times

0

I wanted more or less this format however, when I will fill the last editext, goes up the keyboard and comes out 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>
  • 3

    see if this helps http://answall.com/questions/131295/problemas-com-o-layout-da-aplica%C3%A7%C3%A3o-em-diversos-celulares/134290#134290

1 answer

0

You can add the following code to Androidmanifest in the Activity in question

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

So Activity always reorganizes to give space to the keyboard

Browser other questions tagged

You are not signed in. Login or sign up in order to post.