在约束布局中扩展视图

时间:2018-07-05 18:34:24

标签: android android-constraintlayout

由于第一个单元格(左单元格)正在扩展,因此我尝试垂直扩展第二个单元格(右单元),因为第二个单元格正在扩展,而第二个单元格正在扩展,因此我希望第一个单元格垂直扩展。 as in the image

不久,我希望单元格具有相同的高度(如果其中之一被垂直扩展)。我可以使用约束布局吗?我正在使用1.1.2版本

这是我的xml布局

<android.support.constraint.ConstraintLayout
     ....
    <android.support.constraint.ConstraintLayout
            android:id="@+id/rateUsConstraintLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            app:layout_constrainedHeight="true"
            android:background="@drawable/others_button_background"
            android:onClick="onButtonClick"
            android:paddingLeft="8dp"
            android:paddingRight="8dp"
            app:layout_constraintEnd_toEndOf="@+id/soundConstraintLayout"
            app:layout_constraintHeight_default="wrap"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
            app:layout_constraintTop_toBottomOf="@+id/soundConstraintLayout">

            <ImageView
                android:id="@+id/imageView12"
                android:layout_width="40dp"
                android:layout_height="45dp"
                android:layout_marginTop="16dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/rate_us_icon" />

            <TextView
                android:id="@+id/rateUs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/imageView12"
                tools:text="rate us hfjsljfs nflndlks nflndlsjl nfjdjlsjld nlfklsjdjf" />
        </android.support.constraint.ConstraintLayout>

        <android.support.constraint.ConstraintLayout
            android:id="@+id/contactUsConstraintLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            android:background="@drawable/others_button_background"
            app:layout_constrainedHeight="true"
            android:onClick="onButtonClick"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
            app:layout_constraintHeight_default="wrap"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="@+id/languageConstraintLayout"
            app:layout_constraintTop_toBottomOf="@+id/soundConstraintLayout">

            <ImageView
                android:id="@+id/imageView13"
                android:layout_width="50dp"
                android:layout_height="45dp"
                android:layout_marginTop="16dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/contact_us_icon" />

            <TextView
                android:id="@+id/contactUs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/imageView13"
                tools:text="contact us" />
        </android.support.constraint.ConstraintLayout>
          ...
 <android.support.constraint.ConstraintLayout

0 个答案:

没有答案