I'm guessing that all of your layouts except one are ending up with a
zero width, or zero length. In any case, the simplest way I can think
of to put multiple lists in the same layout is to use LinearLayout,
and set a pixel height to each list:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:background="#ffffffff"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"/>
<ListView android:id="@+id/list_1"
android:layout_width="fill_parent"
android:layout_height="100px"
android:layout_below="@id/text_view"/>
<ListView android:id="@+id/list_2"
android:layout_width="fill_parent"
android:layout_height="100px"
android:layout_below="@id/list_2"/>
<ListView android:id="@+id/list_3"
android:layout_width="fill_parent"
android:layout_height="100px"
android:layout_below="@id/list_3"/>
</LinearLayout>
You can set the pixel height in either the xml or in the code by
calling ListView.setMinimumHeight, which is best called in either your
onCreate or onStart override methods of your activity.
Here's some source code:
http://www.bungeebot.net/AndMultiList.zip
On May 14, 8:34 am, daehoon <[email protected]> wrote:
> hi all,,
> I want to set some lists in one layout,
> but I found it's only recognize the first <ListView .
> how to write xml file ?
> anyone help?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---