I thought this would be really simple but its proving to be very difficult. Im trying to create a simple view with a list of 13 images that I can scroll down. Im using the xml code below but the result is not what I expected. I’m getting a scrollable list of images starting with the bottom part of the 5th image and complete images of 6 – 13. at the bottom of the scrollview there is a bunch of empty space about the same size as the space I imagine the missing images would take up….. any ideas?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@color/back"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/ScrollView01" android:layout_gravity="center"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout android:id="@+id/LinearLayout02" android:orientation="vertical"
android:layout_gravity="center" android:layout_height="wrap_content"
android:layout_width="fill_parent">
<ImageView android:src="@drawable/s1" android:id="@+id/imageView1"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s2" android:id="@+id/imageView2"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s3" android:id="@+id/imageView7"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s4" android:id="@+id/imageView11"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s5" android:id="@+id/imageView10"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s6" android:id="@+id/imageView9"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s7" android:id="@+id/imageView8"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s8" android:id="@+id/imageView4"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s9" android:id="@+id/imageView5"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s10" android:id="@+id/imageView6"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s11" android:id="@+id/imageView3"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s12" android:id="@+id/imageView13"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
<ImageView android:src="@drawable/s13" android:id="@+id/imageView12"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
I think that using a ‘GridView’ in your case could be a better and most clean solution.