这里是布局文件,在build.gradle文件中添加了对讲依赖关系之后,“切换”按钮位于顶部,Textview在Imageview之前对齐, 添加此库后,约束布局中的UI问题很少了,我们将不胜感激。
我曾尝试解决此布局问题,但后来我看到其他XML文件受到影响,只有约束布局出现了此问题,其余的都工作正常
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.constraint.Guideline
android:id="@+id/right_guideline_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".12" />
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="0dp"
android:paddingStart="7dp"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/right_guideline_switch"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/left_guideline_safe_zone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".162" />
<com.mobiusworks.mywagr.views.MGoelCustomTextView
android:id="@+id/tv_safe_zone_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:text="TextView"
android:textColor="@color/wagrDarkGrey"
android:textSize="@dimen/link_text_size_relative_30"
app:assets="@string/font_comfortaa_regular"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/iv_edit_safe_zone"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline_safe_zone"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/left_guideline_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".94" />
<android.support.constraint.Guideline
android:id="@+id/right_guideline_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".90" />
<android.support.constraint.Guideline
android:id="@+id/left_guideline_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent=".84" />
<ImageView
android:id="@+id/iv_delete_safe_zone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/delete"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline_delete"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_edit_safe_zone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:adjustViewBounds="true"
android:src="@drawable/ic_edit_blue"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline_edit"
app:layout_constraintRight_toLeftOf="@+id/right_guideline_edit"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
https://drive.google.com/file/d/1vTBRp5tILB3QOT-m80Ao6iW1PtU2_4r7/view?usp=sharing
https://drive.google.com/file/d/1qHbDPG5VkDBB-6dHmKmDm1B6teyFUFCg/view?usp=sharing
检查链接1以获取预期的UI,并查看链接2在添加对讲依赖性后其可见性
谢谢。