Md Tariqul Islam
Md Tariqul Islam

Reputation: 2804

tools:layout_editor_absoluteY not working

I try to design a layout using android.support.constraint.ConstraintLayout, from android studio I can see the preview is good but when I built and run in phone the preview is showing one after another that i never want.

my layout design: enter image description here

<?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"
    android:background="@color/black"
    tools:context="co.gakkmedia.videoapps.DetailsViewActivity">


    <ImageView
        android:id="@+id/videoView"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        tools:layout_editor_absoluteY="0dp"
        tools:layout_editor_absoluteX="0dp"
        android:src="@drawable/video_preview_01"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Arraw"
        android:textSize="20dp"
        tools:layout_editor_absoluteY="166dp"
        tools:layout_editor_absoluteX="0dp"

        android:textColor="@color/white"

        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="09.45.05"
        tools:layout_editor_absoluteY="166dp"
        tools:layout_editor_absoluteX="291dp"

        android:textSize="20dp"
        android:textColor="@color/white"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="2016"
        tools:layout_editor_absoluteY="200dp"
        tools:layout_editor_absoluteX="0dp"

        android:textSize="20dp"
        android:textColor="@color/white"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="5 sections"
        tools:layout_editor_absoluteY="200dp"
        tools:layout_editor_absoluteX="101dp"

        android:textSize="20dp"
        android:textColor="@color/white"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Add to MyPlaylist"
        tools:layout_editor_absoluteY="243dp"
        tools:layout_editor_absoluteX="112dp"

        android:textSize="20dp"
        android:textColor="@color/white"
        />

</android.support.constraint.ConstraintLayout>

Upvotes: 5

Views: 9775

Answers (1)

Juan Martinez
Juan Martinez

Reputation: 770

The layout_editor attributes are only used for the editor preview and have no effect on the final layouts. You should position your elements using the ConstraintLayout specific attributes.

Upvotes: 12

Related Questions