2017-05-02 7 views
4

나는 그 안에 몇 개의 뷰가있는 ConstraintLayout을 가지고 있으며, 어떤 이유에서든 내 textview이 문장의 끝 부분에서 잘 리게됩니다. textview은 왼쪽과 위쪽으로 제한됩니다. tv_product_descriptiontextview입니다.ConstraintLayout은 텍스트 뷰에서 텍스트를 자릅니다.

<android.support.constraint.ConstraintLayout 
    android:id="@+id/ll_product_holder" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="16dp" 
    android:layout_marginRight="16dp" 
    android:layout_marginTop="16dp" 
    android:background="@drawable/drawable_border" 
    android:orientation="vertical"> 

    <com.facebook.drawee.view.SimpleDraweeView 
     android:id="@+id/iv_product_image" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:layout_marginBottom="8dp" 
     android:layout_marginLeft="9dp" 
     android:layout_marginStart="9dp" 
     android:layout_marginTop="13dp" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/price_holder" 
     fresco:actualImageScaleType="centerCrop" 
     fresco:placeholderImage="@drawable/placeholder2"/> 

    <TextView 
     android:id="@+id/tv_product_id" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="9dp" 
     android:layout_marginStart="9dp" 
     android:layout_marginTop="13dp" 
     android:text="@{historyItem.productId}" 
     app:layout_constraintLeft_toRightOf="@+id/iv_product_image" 
     app:layout_constraintTop_toBottomOf="@+id/price_holder"/> 

    <TextView 
     android:id="@+id/tv_product_description" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="9dp" 
     android:layout_marginStart="9dp" 
     android:ellipsize="end" 
     android:maxLines="2" 
     android:text="@{historyItem.productDescription}" 
     app:layout_constraintLeft_toRightOf="@+id/iv_product_image" 
     app:layout_constraintTop_toBottomOf="@+id/tv_product_id"/> 

</android.support.constraint.ConstraintLayout> 

Here you can see the textview being cut off.

답변

8

뿐만 아니라

app:layout_constraintRight_toRightOf="parent" 

같은 권리 제한 조건을 추가하십시오 및

android:layout_width="0dp" 

출력과 같은 폭 0dp 설정하십시오

enter image description here

+0

'constraintRight'를 추가하려고 시도했지만'textview '가 모두 엉망이되어 버린 것처럼 보입니다. 왼쪽 제약이 무시되어 여전히 잘린 것처럼 보입니다. – Esteban

+0

나는 이미 내 컴퓨터에서 테스트를 마쳤지 만 부모 레이아웃에 속하지 않은 몇 가지 제약 조건을 이미 부여했다. –

+0

'android : layout_width = "0dp"'당신을 위해 잘되기를 바랍니다. –