1

I am working on an app that has screen having multiple ListViews and that ListViews will contain Images by categories as (1st-Day, 2nd-Day and 3rd-Day). I have manged 3 different custom Adapters for this purpose and getting all Images from same service in a single ArrayList, just setting the adapter according date. My problem is I need this screen to work like I want. This screen should be scrollable but in my case the listview just have some specific place on the screen instead it should expand to the bottom as of many list Items and by scrolling the second listview should be shown. I tried many solutions but didn't get what I actually want. I have also tried headers but that too not working for me the same problem of place. Below is the image how my screen looks like. As you can see the first ListView is just on a little place even it has many items and it should be expanded as of many Items but it don't.

enter image description here

And here is my XML Layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background" >

    <LinearLayout
        android:id="@+id/linearlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/re3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent" >



            <TextView
                android:id="@+id/tv1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="1dp"
                android:gravity="center"
                android:text="1st-Day"
                android:textColor="#FFFFFF"
                android:textSize="30sp"
                android:textStyle="bold" />
        </RelativeLayout>

        <ListView
            android:id="@+id/list1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            >
        </ListView>

        <RelativeLayout
            android:id="@+id/re4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent" >


            <TextView
                android:id="@+id/tv2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="1dp"
                android:gravity="center"
                android:text="2nd-Day"
                android:textColor="#FFFFFF"
                android:textSize="30sp"
                android:textStyle="bold" />
        </RelativeLayout>

        <ListView
            android:id="@+id/list2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            >
        </ListView>
    </LinearLayout>

</RelativeLayout>
Abid Khan
  • 2,451
  • 4
  • 22
  • 45
  • Refer to my answer [link 1](http://stackoverflow.com/questions/19129975/android-auto-merge-two-listview-in-one-screen/19130449#19130449) and [link 2](http://stackoverflow.com/questions/14702650/scrollview-with-a-listview-doesnt-scroll-android) – Manishika Apr 09 '14 at 09:34
  • Still the same result the second day textview is on the same place and I want as the firstList expands the other things below should go down and on scrolling that should be shown there. – Abid Khan Apr 09 '14 at 09:47

1 Answers1

0

I have same required and for this You should use liner layout instead of ListView inside scroll view. See This

and this was solved my problem.

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

<LinearLayout 
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<LinearLayout 
    android:id="@+id/list1"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<LinearLayout 
    android:id="@+id/list2"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<LinearLayout 
    android:id="@+id/list3"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

 </LinearLayout>
 </ScrollView>
Community
  • 1
  • 1
Ravi Bhandari
  • 4,682
  • 8
  • 40
  • 68