I have started building an app with two ListView's under each other.
Now i put an ScrollView over it, because the amout of itmes might get very big and therefore i want the whole layout to be scrollable and not the lists itself. But my solution dosent work!
btw: i dont want to replace my ListViews with a LinearLayout or so because then all my adapters are gone.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/Heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ListView1" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
style="@style/ButtonStyle.SpinnerAddButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_add_black_24dp"
android:onClick="addToList1" />
</LinearLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/marginLeft"
android:layout_marginRight="@dimen/marginLeft" />
<!--Second list-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/Heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ListView2" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
style="@style/ButtonStyle.SpinnerAddButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_add_black_24dp"
android:onClick="addToList2" />
</LinearLayout>
<ListView
android:id="@+id/listView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/marginLeft"
android:layout_marginRight="@dimen/marginLeft" />
</LinearLayout>
</ScrollView>
My Layout now shows all the ListViews under each other but only one Item per ListView and you can then scroll through this Lists.