2016-11-08 32 views
1

使用ConstraintLayout,我試圖將視圖定位到2 guidelines,如您在附加屏幕截圖中的藍圖中所看到的。Android的ConstraintLayout - 將視圖定位到2個指導原則

enter image description here

如何過,視圖被放置在屏幕的左上角,而不是由兩個準則進行約束。
任何想法,爲什麼這haved?

謝謝!

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


    <TextView 
     android:layout_width="98dp" 
     android:layout_height="17dp" 
     android:background="#FAFA00" 
     app:layout_constraintTop_toTopOf="@+id/guideline" 
     app:layout_constraintRight_toLeftOf="@+id/guideline2" 
     android:layout_marginEnd="32dp" 
     android:layout_marginRight="32dp" 
     android:layout_marginTop="64dp"/> 

    <android.support.constraint.Guideline 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/guideline" 
     android:orientation="horizontal" 
     tools:layout_editor_absoluteY="247dp" 
     tools:layout_editor_absoluteX="0dp" 
     app:layout_constraintGuide_end="576dp"/> 

    <android.support.constraint.Guideline 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/guideline2" 
     android:orientation="vertical" 
     tools:layout_editor_absoluteY="0dp" 
     tools:layout_editor_absoluteX="422dp" 
     app:layout_constraintGuide_end="178dp"/> 

</android.support.constraint.ConstraintLayout> 
+0

你可以在這裏報告這個錯誤:http://tools.android.com/feedback – Fabricio

回答

0

有一個與beta4中修復的指南相關的錯誤 - 嘗試更新,它應該可以解決您的問題。

相關問題