I have a list view. The layout for each row is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:paddingLeft="16dp"
app:columnCount="4">
<View
android:layout_width="3dp"
android:layout_height="wrap_content"
app:layout_row="0"
app:layout_column="1"
app:layout_rowSpan="3"
android:background="@color/background_floating_material_dark"
/>
<ImageView
android:id="@+id/imageView"
android:layout_width="32dp"
android:layout_height="32dp"
app:layout_row="0"
app:layout_column="3"
app:layout_gravity="center_vertical"
android:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_row="0"
app:layout_column="2"
android:maxWidth="210dp"
android:singleLine="true"
app:layout_gravity="right|center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:ellipsize="end"
android:layout_margin="10dp"
android:text="This is title"
/>
<TextView
android:id="@+id/start_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_gravity="left|center_vertical"
app:layout_row="0"
app:layout_column="0"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:text="۱۱ ق.ظ"
android:paddingRight="5dp"
/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_gravity="right|center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/button_material_dark"
android:layout_margin="6dp"
app:layout_row="1"
app:layout_column="2"
android:text="subtitle1" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="25dp"
android:layout_height="25dp"
app:layout_gravity="center_horizontal|center_vertical"
android:src="@drawable/ic_supervisor_account_black_24dp"
app:layout_row="1"
app:layout_column="3"/>
</android.support.v7.widget.GridLayout>
What I want to have is this:
But when I change the GridLayout height to wrap_content, the black line disappears. I can see the black line if I set the height to a constant value:
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="150dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
app:columnCount="4">
But I don't want to have a same height for each row. What is the problem?