Constraint Layout not working, maybe a bug in design editor?

Viewed 2745

I am creating my first app with android studio and this is my first problem:

I want to try the ConstraintLayout. I have built the layout with a ConstraintLayout with the Design Editor (clicking it together). When i try the layout in Android Emulator, all Buttons have moved in the left upper corner :( Except the "Hello World" Label which was generated automatically when i created my first project.

The difference between the Label and the Button is, that some code lines beginning with app:layout_constraint.... are missing. You can see it in Code.

What am I doing wrong, or is it a bug? I would be glad for an answer! :)

<?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.u0017007.coffeecounter.MainActivity">

    <TextView
        android:layout_width="136dp"
        android:layout_height="30dp"
        android:text="Hello World!"
        android:textSize="24sp"
        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.234" />

    <Button
        android:id="@+id/buttonAddCoffee"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:freezesText="false"
        android:text="@string/add_coffee"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="231dp" />

    <Button
        android:id="@+id/buttonRemoveCoffee"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/remove_coffee"
        tools:layout_editor_absoluteX="236dp"
        tools:layout_editor_absoluteY="231dp" />

</android.support.constraint.ConstraintLayout>
3 Answers
Related