Messy items Android Studio 2.3

2

Does anyone know why the objects go out of order? when you ran the application in the emulator, the objects are displayed as messy in the application and not as they are displayed in the development interface. :(  This happened after the android studio was updated a few days ago. They would love your help!

XML

<Spinner
    android:id="@+id/spinner1"
    android:layout_width="368dp"
    android:layout_height="wrap_content"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="193dp" />

<EditText
    android:id="@+id/et1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:hint="Ingresa el primer numero"
    android:inputType="textPersonName"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="36dp" />

<EditText
    android:id="@+id/et2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:ems="10"
    android:hint="Ingresa el segundo numero"
    android:inputType="textPersonName"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    tools:layout_editor_absoluteY="104dp"
    app:layout_constraintHorizontal_bias="0.052" />

<TextView
    android:id="@+id/tv1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Resultado"
    tools:layout_editor_absoluteX="168dp"
    tools:layout_editor_absoluteY="293dp" />

    
asked by isgb 05.03.2017 в 20:46
source

3 answers

0

is just what I told you.

Look at this fragment of your code:

<Spinner
    android:id="@+id/spinner1"
    android:layout_width="368dp"
    android:layout_height="wrap_content"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="193dp" />

As you see, there is no constraint and your controls are positioned globally in the upper left corner. Read this page and you will see how you manage to do what you want:

link

If you have more questions ask around here but I think that reading that you can.

    
answered by 05.03.2017 / 21:35
source
0

It's because of the constraint, a quick way to solve it is by right clicking on the item - > constraint layout - > Infer Constraints

Look if you understand what I mean

    
answered by 27.06.2017 в 19:07
-1

All that code you put in the xml should be framed or included in a LinearLayout or a RelativeLayout. In the first you must use android: orientation="vertical" so that they line up one below the other. With the RelativeLayout you have more flexibility when ordering frame components. Look for information on link about layouts.

    
answered by 05.03.2017 в 21:59