Been trying to figure this out.. I am new to Adroid and trying to get the whole screen to scrollview...it's a header image and a list...would like it to all scroll together. Can it be done using this layout? Thanks!
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/containerView"
android:background="@android:color/transparent"
android:padding="0dip"
android:layout_margin="0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headerImageContainer"
android:background="@android:color/transparent"
android:padding="0dip"
android:layout_margin="0dip"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headerImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="center"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true">
</ImageView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listViewContainer"
android:background="@android:color/transparent"
android:paddingLeft="35dip"
android:paddingRight="35dip"
android:paddingTop="10dip"
android:paddingBottom="0dip"
android:layout_margin="0dip"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/headerImageContainer">
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView"
android:background="@android:color/transparent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#000000"
android:choiceMode="singleChoice"
android:layout_weight="1"
android:scrollbars="none">
</ListView>
</LinearLayout>
</RelativeLayout>
what do you mean by scroll together. If you wanna to scroll image as well when you move from item 1 to item n. then instead of using scroll view better to integrate your list view with a image in first row or make that image as header for the the list items. Scroll view is used to scroll where as list view has in built scroll view hat scrolls the items.
Encapsulate everything you have in
<LinearLayout
...>
<ScrollView
...>
Your original XML content here
</ScrollView>
</LinearLayout>
And it should work.