I have the following layout but I would like to make it scroll vertically if the content is too much for the display. The ImageView, 'imagePhoto' is an image taken with the device camera. If the picture is taken Portrait then then layout needs to be able to scroll. I tried adding a ScrollView before the LinearLayout as follows:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
But it did not seem to work.
Any suggestions??
Here is the layout xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widgetUploadPhoto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffffff"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/topLevelMenuBackground"
android:orientation="horizontal">
<TextView
android:id="@+id/tvHeaderText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#ffffffff"
android:textSize="20sp"
android:shadowColor="#7F000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_centerVertical="true" />
</RelativeLayout>
<TextView
android:id="@+id/tvYourCurrentPhoto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Your current photo:"
android:background="#ffffffff"
android:textColor="#ff626262"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:textSize="@dimen/text_size_medium"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp"
android:visibility="gone" />
<ImageView
android:id="@+id/imagePhoto"
android:src="@drawable/OrangeAccessoryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:background="#ffffffff"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Select an option below to change your photo."
android:background="#ffffffff"
android:textColor="#ff626262"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:textSize="@dimen/text_size_medium" />
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:focusable="false"
android:layout_weight="1" />
</LinearLayout>
Thanks for any help/suggestions.
UPDATED XML:
NOTE: This works, but it is not the expected results. I only want the stuff in the RelativeView to scroll. The first TexView is a header, which I want to remain stationary and the views under it to scroll. Basicaly, everything should scroll, but the relative vie section.
<?xml version="1.0" encoding="utf-8"?>
<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"
android:id="@+id/widgetUploadPhoto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffffff"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/topLevelMenuBackground"
android:orientation="horizontal">
<TextView
android:id="@+id/tvHeaderText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#ffffffff"
android:textSize="20sp"
android:shadowColor="#7F000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_centerVertical="true" />
</RelativeLayout>
<TextView
android:id="@+id/tvYourCurrentPhoto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Your current photo:"
android:background="#ffffffff"
android:textColor="#ff626262"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:textSize="@dimen/text_size_medium"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp"
android:visibility="gone" />
<ImageView
android:id="@+id/imagePhoto"
android:src="@drawable/OrangeAccessoryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:background="#ffffffff"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Select an option below to change your photo."
android:background="#ffffffff"
android:textColor="#ff626262"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:textSize="@dimen/text_size_medium" />
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:focusable="false"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>