I am adding two list view in one scroll view, as my both listview(s) will contains data, but the problem I am facing is that when I add listview(S) in scroll view, it only shows one item of each list view.
Here is the image,
The XML code is :
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/layoutFooter7"
android:layout_below="@+id/linArrange" >
<RelativeLayout
android:id="@+id/linListViews"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/lstviewUnBlockVenues"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="#00000000"
android:dividerHeight="0dp"
android:fadeScrollbars="false" >
</ListView>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lstviewUnBlockVenues"
android:background="#ABCDEF"
android:orientation="vertical" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Blocked Venues"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#061218" />
</LinearLayout>
<ListView
android:id="@+id/lstviewBlockedVenues"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/linearLayout1"
android:cacheColorHint="#00000000"
android:divider="#00000000"
android:dividerHeight="0dp"
android:fadeScrollbars="false" >
</ListView>
</RelativeLayout>
</ScrollView>
All I want is that scroll view should scroll down if the list view contains more items, as at this moment both list views are displaying one item only :(
Try using a LinearLayout and weight. Your problem is wrap_content won't make the ListViews fill 50% of the screen.
Something like this:
It's best you modify your UI.
Placing one scrolling widget in another in Android really creates lot of problems. There is a workaround but that makes scrolling a pain for the user.
For more information you may click on any of the results that show up on the google search
You can find a tutorial on the best way is to use ExpandableListView here
I used "arnp" 's answer and made and example with 3 listView in scrollview. It works fine.
layout :
Activity :