I have a ListView with a custom layout, whichs consists of an image on the left hand side, and two TextViews next to it.
Since the height of the list item should not be higher than the image, I have considered defining the height to be 150px, which is the size of the image.
However, this is causing Android Studio to show me a warning.
Is setting the height of the item in pixels considered bad practice in this case, and if so, how should I fix it?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:src="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceLarge"
tools:text="Text" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
tools:text="Text" />
</LinearLayout>
This is a picture of the layout I want to create: