So I just started android development and I arranged a few buttons and textViews in the xml design mode and when I ran it in an emulator and on my phone, the widgets seem to automatically move to the top left except the widget that was already there (like the TextView with hello world). I was following this video tutorial and I think the widgets are supposed to align themselves with some parent object by default but it wasn't doing that for me. Can someone help me with this?
Here's my xml code :
<?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.danishdua.testapp.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"
app:layout_constraintVertical_bias="0.032" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
tools:layout_editor_absoluteX="5dp"
tools:layout_editor_absoluteY="230dp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
tools:layout_editor_absoluteX="278dp"
tools:layout_editor_absoluteY="230dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Just a textView"
tools:layout_editor_absoluteX="163dp"
tools:layout_editor_absoluteY="478dp" />
Basically, what I see on android studio is this:Android Studio
And what I see on emulator is: Android emulator
Thanks!