I am trying to wrap a realtive view in a scrollview as per the code below. However the problem is that the view doesn’t scroll, even though part of the view is off the screen. I am testing this on the emulator.
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical"
>
<TextView
android:id="@+id/namedetail"
android:background="@drawable/backgroundstate"
android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="50dip"
android:textColor="#FF000000"
android:textStyle="bold"
android:textSize="15sp"
android:typeface="sans"
/>
<ImageView android:id="@+id/picturedetail"
android:layout_width="175dip"
android:layout_height="175dip"
android:layout_below="@id/namedetail"
android:layout_marginLeft="75dip"
android:layout_marginTop="10dip"
/>
<ImageView android:id="@+id/infoboxdetail"
android:layout_width="225dip"
android:layout_height="100dip"
android:layout_marginLeft="50dip"
android:layout_marginTop="10dip"
android:layout_below="@id/picturedetail"
android:background="@drawable/backgroundstate"
/>
<TextView
android:id="@+id/descriptiondetail"
android:background="@drawable/backgroundstate"
android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="50dip"
android:textColor="#FF000000"
android:textStyle="bold"
android:textSize="15sp"
android:typeface="sans"
android:layout_below="@id/infoboxdetail"
android:layout_marginTop ="10dip"
/>
</RelativeLayout>
</ScrollView>
EDIT
OK solved – user stupidity – the bottom text box was off the screen on my monitor but not in the emulator. Making it longer makes it now scroll.
Your
RelativeLayoutishorizontaland you use aScrollView, try aHorizontalScrollViewinstead.