小编Hus*_*dar的帖子

约束布局:Textview 文本重叠按钮

我第一次遇到这个问题,我的文本与按钮重叠,我尝试使用屏障,指南但在按钮中心获取文本并启动父级。我正在实现 textViews 文本将从父级开始并在按钮之前结束,按钮始终保持在父级的末尾,如下图所示。
在此处输入图片说明

我的布局。

 <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TextView
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:id="@+id/titleTextView"
            android:text="title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    <TextView
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/titleTextView"
            android:id="@+id/descriptionTextView"
            android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    <ImageView
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            android:id="@+id/copyImageView"
            android:tint="?android:textColorSecondary"
            android:src="@drawable/ic_content_copy_black_24dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout android-constraintlayout

3
推荐指数
2
解决办法
2913
查看次数