2017-05-15 3 views
1

Ich habe diese einfache Layout:Android: ConstraintLayout hat ein anderes Verhalten auf SDK 4.1.x

<android.support.constraint.ConstraintLayout 
      android:id="@+id/main_layout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:layout_constraintTop_toTopOf="parent" 
      android:paddingLeft="@dimen/keyline_1"> 

      <com.xxx.ui.widget.CustomTextViewFont 
       android:id="@+id/title" 
       style="@style/FlatCardTitle" 
       android:paddingTop="@dimen/keyline_1" 
       android:layout_marginRight="@dimen/keyline_1" 
       app:layout_constraintLeft_toLeftOf="parent" 
       app:layout_constraintRight_toLeftOf="@+id/actions_layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:maxLines="2" 
       android:ellipsize="end" 
       app:customFont="OpenSans-CondBold.ttf" /> 

      <FrameLayout 
       android:id="@+id/actions_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       app:layout_constraintRight_toRightOf="parent" 
       android:visibility="gone"> 

       ..... 
      </FrameLayout> 

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

Auf Android 5.x, die actions_layout ist korrekt auf der rechten Seite der Ansicht. ABER in 4.1.x die actions_layout stills in links.

Danke für Sie Unterstützung Jungs!

Antwort

1

Ich hatte das gleiche Problem. Die Angabe der oberen und unteren Beschränkungen hat mir geholfen. Versuchen Sie diesen Weg.

app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:layout_constraintHorizontal_bias="1" 
Verwandte Themen