工具:layout_editor_absoluteY无法正常工作 [英] tools:layout_editor_absoluteY not working

查看:246
本文介绍了工具:layout_editor_absoluteY无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用android.support.constraint.ConstraintLayout设计布局,从android studio中可以看到预览效果很好,但是当我在手机中构建并运行该预览效果时,预览效果会逐个显示,这是我不想要的.

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.

我的版式设计:

<?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>

推荐答案

layout_editor属性仅用于编辑器预览,对最终布局没有影响.您应该使用ConstraintLayout特定属性定位元素.

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.

这篇关于工具:layout_editor_absoluteY无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆