Does android.widget.TwoLineListItem do what you want?

BTW - looks like the outer LinearLayout is unnecessary in list.xml and
listadapter.xml.

On Dec 29, 5:41 pm, Mystique <[email protected]> wrote:
> Hi,
> I have an app that I mine data with an ArrayList and load to an
> ArrayAdapter to display as listview. How can I do more than 1 textview
> item in 1 roll? My code is:
>
> ---list.xml---
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>         android:layout_width="fill_parent"
>         android:layout_height="fill_parent"
>     android:background="@drawable/selector"
>         android:padding="10sp">
> <TextView
>         android:id="@+id/listA"
>     android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>     android:singleLine="true"
>     android:gravity="center_vertical|left"
>     android:textAppearance="?android:attr/
> textAppearanceMediumInverse">
> </TextView>
> </LinearLayout>
>
> --listadapter.xml---
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>         <ListView
>     android:id="@+id/listView"
>     android:cacheColorHint="#000000"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     />
> </LinearLayout>
>
> --code---
>     lv1=(ListView)findViewById(R.id.listView);
>     lv1.setAdapter(new ArrayAdapter<String>(this,
> R.layout.listadapter, R.id.listA, allTheList2));
>
> all is ok for single line.
>
> --- try to do but fail ---
> Create another TextView such as:
>
> <TextView
>         android:id="@+id/listB"
> blah blah...
>
> then add another:
>     lv1.setAdapter(new ArrayAdapter<String>(this,
> R.layout.listadapter, R.id.listB, allTheList2));
>
> But fail. Basically, what I want to do is to mine data DATA_FIELD1,
> DATA_FIELD2 populate into a listview to display (single roll):
> DATA_FIELD1 (Larger font)
> DATA_FIELD2 (Smaller font)
>
> I can't find any example to do this, can anyone please advice?
>
> Many Thanks,
> CJ

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to