vendredi 27 juin 2014

How to add rows with different layouts files in Array List?


Vote count:

0




i am using a list view and want to add rows to it, i know how to add simple rows with Array adapter but this time i want to add Custom rows with different layout files.


how could i achieve it??


here are my 3 XML files that i want to add



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<Button
android:id="@+id/creditBestValuePurchase"
android:layout_width="85dp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:background="@drawable/btn_save_normal"
android:gravity="center_vertical|center_horizontal"
android:text="$ 14.99" />

<TextView
android:id="@+id/creditBestValueNoOfCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/creditBestValuePurchase"
android:layout_alignBottom="@+id/creditBestValuePurchase"
android:layout_alignParentLeft="true"
android:layout_marginRight="15dp"
android:layout_marginLeft="16dp"
android:text="5000 credits" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/creditBestValueNoOfCredits"
android:layout_alignBottom="@+id/creditBestValueNoOfCredits"
android:layout_centerHorizontal="true"
android:background="@drawable/yellow"
android:gravity="center_vertical|center_horizontal"
android:text="BEST VALUE" />

</RelativeLayout>


similarly i have 2 other layouts


so how would i add these to list view?


help would be greatly appreciated.



asked 1 min ago

Dude

26





Aucun commentaire:

Enregistrer un commentaire