问题:

<TextView
        android:id="@+id/tv_answer_content_item_answer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/dp_10"
        android:layout_marginTop="@dimen/dp_15"
        android:text="我是来占前排的,求更多类似文章。我是来占前排的,求更多类似文章。"
        android:textColor="@color/base_black"
        android:textSize="@dimen/sp_15"
        app:layout_constraintLeft_toRightOf="@id/iv_avatar_item_question_detail"
        app:layout_constraintTop_toBottomOf="@id/tv_time_item_answer" />

解决办法:

/*1.将宽度属性设置为0dp*/ 
android:layout_width="0dp"
/*2.将水平方向上的权重设置为1*/ 
app:layout_constraintHorizontal_weight="1"
/*3.添加右边方向上的约束为parent*/
app:layout_constraintRight_toRightOf="parent"

<TextView
        android:id="@+id/tv_answer_content_item_answer"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/dp_10"
        android:layout_marginTop="@dimen/dp_15"
        android:text="我是来占前排的,求更多类似文章。我是来占前排的,求更多类似文章。"
        android:textColor="@color/base_black"
        android:textSize="@dimen/sp_15"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintLeft_toRightOf="@id/iv_avatar_item_question_detail"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tv_time_item_answer" />

ok。解决了。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐