I have a layout like this:
<ScrollView
android:id="@+id/ScrollViewHome"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:fillViewport="true" >
<LinearLayout
android:id="@+id/contentOuter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal" >
<Gallery
android:id="@+id/home_banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dip" >
</Gallery>
</LinearLayout>
</ScrollView>
It will show my Gallery in the middle of screen. There is a blank space above and below Gallery since the image’s height is not fit the whole screen. It’s OK. Then I want to add 2 TextView below the Gallery:
<ScrollView
android:id="@+id/ScrollViewHome"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:fillViewport="true" >
<LinearLayout
android:id="@+id/contentOuter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal" >
<Gallery
android:id="@+id/home_banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dip" >
</Gallery>
<RelativeLayout
android:id="@+id/topHot"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/topHotText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="@string/home_segment_home1"
android:textColor="#8e8e8e"
android:textSize="30dp"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="@string/watch_all"
android:textColor="#8e8e8e"
android:textSize="30dp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
After add the <RelativeLayout>, the blank space above and below Gallery become bigger. And 2 TextView inside <RelativeLayout> is not showing. There’s still only Gallery on the screen. Why’s that? Dis I write something wrong? Please help me out with this.
Apply orientation vertical to Linear Layout in Scroll View. This might be a reason.