I got such problem: i have a MapView and a ListView below it. Map size is fixed. But I need to scroll my views together. I, somehow, handled problems with non-scrolling map and one-itemed-list, but another one showed up – in a ScrollView there are lots of free space below ListView and I can’t get rid of it. I thought that setting for the list to “wrap_content” would help, but it did not.
What to do?
Here is my layout:
<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="wrap_content" >
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<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="wrap_content"
android:orientation="vertical" >
<com.package.MyMapView
android:layout_width="match_parent"
android:layout_height="100dp"
android:clickable="true"
android:apiKey="key"
android:id="@+id/map"
android:layout_gravity="top"/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/channelsList" >
</ListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
Its always not a good idea to wrap ListView inside ScrollView, because both are scrollable views.