Как наложить вид в макете ограничения?

Я имею представление изображения в макете ограничения и хочу, чтобы CardView наложил его. XML:

<com.makeramen.roundedimageview.RoundedImageView

    android:id="@+id/imageView"
    android:layout_width="match_parent"

    android:layout_height="0dp"

    android:layout_marginEnd="8dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginStart="8dp"
    android:layout_marginBottom="16dp"

    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/line"

    app:layout_constraintBottom_toTopOf="@id/btn1">

<android.support.v7.widget.CardView
    android:id="@+id/text_card"
    style="@style/CardViewStyle"
    android:layout_width="0dp"


    android:layout_height="wrap_content"

    android:layout_marginBottom="4dp"
    android:visibility="invisible"
    app:layout_constraintBottom_toBottomOf="@+id/imageView"
    app:layout_constraintEnd_toEndOf="@+id/imageView"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="@+id/imageView">

На современных устройствах все в порядке, но с API ниже 19 ImageView накладывает CardViews. Как я могу это исправить?

1 ответ

Для Android 5+ я думаю, что вы можете добавить высоту, для более низкого apis я не уверен, но попробуйте упорядочить элементы, иначе это может работать

Другие вопросы по тегам