Cardview height doesn't arrange for all items

14 views Asked by At

Error image

Hi, as you can see in the picture in the first element there is another 2 textview and their half is shown. For the second one since the detail section is 2 lined (sometimes it can be) again other 2 textview is not shown here. I provide the XML code below this text. What should I do? Should I increase picture height or can I say to cardview the height will be end of 2 textviews. Thanks for everything.

<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/resimKutusu"
            android:layout_width="250px"
            android:layout_height="250px"
            android:layout_margin="5dp"
            android:contentDescription="@string/my_image_description"
            android:src="@drawable/khont" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:orientation="vertical">

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/eventName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:text="@string/event_name" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/eventDetail"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:text="@string/event_details" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="horizontal">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/eventLocation"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_margin="5dp"
                    android:text="@string/event_location" />

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/eventTime"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:layout_margin="5dp"
                    android:text="@string/event_time" />
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</com.google.android.material.card.MaterialCardView>

I tried to increasing imageview but it looks terrible.

0

There are 0 answers