Android listview displays text over image using array adapter

I overloaded the listView method listView to populate the custom style of the list item.

This is what it looks like now: !!

enter image description here

Red is just a display of the background of the list item.

Here I used 3 controls: Imageview for the image, 2 text views (one top, one bottom).

The problem here is that the height of the list item is increasing. I want two text images above the image no higher or lower. To some extent, I know the root cause of this problem, but I don’t know how to fix it.

Here is the layout of the list item:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp"   >

  <ImageView android:id="@+id/imgIcon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="5dp" 
    android:scaleType="fitCenter"/>

   <TextView android:id="@+id/txtTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="top"
    android:textStyle="bold"
    android:textSize="20sp"
    android:textColor="#FFFFFF"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="2dp"
    android:layout_alignLeft="@+id/imgIcon"
    android:layout_alignTop="@+id/imgIcon"
    android:layout_alignBottom="@+id/imgIcon"/>

   <TextView android:id="@+id/txtTime"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    android:textStyle="bold"
    android:textSize="18sp"
    android:textColor="#FFFFFF"
    android:layout_marginLeft="10dp"
    android:layout_marginBottom="5dp"
    android:layout_alignLeft="@+id/imgIcon"
    android:layout_alignTop="@+id/imgIcon"
    android:layout_alignBottom="@+id/imgIcon"/>

, png- Imageview, . , , , , , , ( ).

enter image description here

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" 
android:layout_width="fill_parent"
android:layout_height="70dp"
android:padding="5dp"   >

, - , . ( ). .

. : PNG, . ( - , resourcE?. , . enter image description here

+1
2

, getView() CustomArrayAdaptor, , ImageView , ( , ) View.setBackgroundResource(R.drawable.yourimage.png) , . xml :

Android:. = "@/yourimage"

, .

+1

, , , , . ( Linear Layout ), .

+1

All Articles