Skip to content Skip to sidebar Skip to footer

Android Custom Adapter With Imageview And Textview

I am using the following xml layout for my custom adapter.

Solution 1:

Use a Relativelayout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/imageView1" 
        android:layout_alignParentLeft="true"
        android:text="TextView" />



    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/textView1"
        android:layout_toLeftOf="@id/imageView1" 
        android:layout_alignParentLeft="true"
        android:text="TextView" />

</RelativeLayout>

Post a Comment for "Android Custom Adapter With Imageview And Textview"