Error in Android studio layout [duplicated]

0

I'm doing an app on Android but I have the problem that when I run the app on my device I throw all my objects in the same space. Do you think you know what is due? Here is my XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.sac_a.owsapp.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btnQr"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Vista QR"
        tools:layout_editor_absoluteX="46dp"
        tools:layout_editor_absoluteY="388dp"
        tools:ignore="MissingConstraints" />

    <Button
        android:id="@+id/btnGps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clickGps"
        android:text="Vista Gps"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="253dp"
        tools:layout_editor_absoluteY="99dp" />

</android.support.constraint.ConstraintLayout>

This is how it looks on my device  

As always, I am infinitely grateful for your help.

    
asked by E.Rawrdríguez.Ophanim 02.02.2018 в 00:03
source

2 answers

-2

What happens is that you have to delete the constrain and put relative layout I have already passed good luck

    
answered by 02.02.2018 / 00:10
source
1
  

When I run the app on my device I throw all my objects in the   same space

This is because you are using ConstraintLayout , for this you have to add restrictions to each of the elements that you will have in your view.

Tutorials on using ConstraintLayout:

link

link

Question answered, so that you have a vision of the use of restrictions when using ConstraintLayout:

Android Studio message: Missing Constraints in ConstraintLayout

    
answered by 02.02.2018 в 00:26