F
F
foo bar2018-02-24 23:33:22
Android
foo bar, 2018-02-24 23:33:22

How to avoid stretching CardView due to ImageView?

When an ImageView is added, the CardView strangely grows. After removal everything is back to normal.
5a91caa41ab3d060384967.png

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/cvOrderItem"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="0dp"
    android:layout_marginStart="0dp"
    android:layout_marginTop="1dp">

    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

<!-- тут разные контролы -->
        <ImageView
            android:id="@+id/ivCustomer"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tvUnLoad"
            card_view:srcCompat="@drawable/ic_people_blue_900_24dp" />


    </android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>

after removal
5a91cae0347e8551000932.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question