I am trying to adapt a layout that I build with a nexus5, but it always get a different size on my device and I don't know why.
I used constraint layout to build it, and as I know the constraints should adapt on different devices but it is not working; I get always my content to be bigger or to overlap the other content.
Here is my xml of the layout I am building:
<?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.afcosta.inesctec.pt.android.Login"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="25dp">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="52dp"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toTopOf="@+id/textInputLayout6"
android:layout_marginStart="45dp"
android:layout_marginEnd="45dp"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
android:layout_marginBottom="33dp"
app:layout_constraintLeft_toLeftOf="parent"
android:id="@+id/textInputLayout7">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="username" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="48dp"
android:id="@+id/textInputLayout6"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toTopOf="@+id/Login"
android:layout_marginStart="43dp"
android:layout_marginEnd="43dp"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
android:layout_marginBottom="42dp"
app:layout_constraintLeft_toLeftOf="parent">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/Login"
android:layout_width="0dp"
android:layout_height="48dp"
android:background="@color/emerald"
android:text="Entrar"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="@+id/textInputLayout6"
tools:layout_constraintLeft_creator="1"
android:layout_marginBottom="143dp"
app:layout_constraintLeft_toLeftOf="@+id/textInputLayout6" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ainda não tem conta?"
android:layout_marginStart="26dp"
app:layout_constraintBaseline_toBaselineOf="@+id/textView5"
tools:layout_constraintBaseline_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="@+id/Login" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Registe-se"
android:textColor="@color/nephritis"
tools:layout_constraintTop_creator="1"
android:layout_marginStart="13dp"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@+id/Login"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toRightOf="@+id/textView3" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="232dp"
android:layout_height="230dp"
app:srcCompat="@drawable/flora"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/textInputLayout7" />
</android.support.constraint.ConstraintLayout>
that is what I see on my emulator: layout
this is what i see on my device: layout