Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – ConstraintLayout在textview中切断文本大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个带有几个视图的ConsTraintLayout,由于某种原因,我的textview在句子末尾被截断. textview受限于左侧和顶部.它是tv_product_description textview.
<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>

解决方法@H_301_8@
添加正确的约束
app:layout_consTraintright_toRightOf="parent"

请设置宽度0dp之类的

android:layout_width="0dp"

产量

大佬总结

以上是大佬教程为你收集整理的android – ConstraintLayout在textview中切断文本全部内容,希望文章能够帮你解决android – ConstraintLayout在textview中切断文本所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。