ScrollView does not show
when using the layout shown below the ScrollView does not show, while if I remove the RelativeLayout just before in the tree (@id/top_bar), it does show. Anybody could explain why?
thanks
Jul
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_detail" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:id="@+id/top_bar"
android:layout_width="fill_parent" android:layout_height="44dp"
android:background="@drawable/nav_bar">
<ImageButton android:id="@+id/btn_map"
android:layout_width="34dp" android:layout_height="34dp"
android:src="@drawable/btn_map"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp" />
<TextView android:id="@+id/top_bar_title"
android:layout_width="200dp" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:gravity="center"
android:textSize="16sp" android:textColor="#FFFFFF"
android:textStyle="bold" android:layout_marginLeft="60dp" />
</RelativeLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="200dp">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="200dp">
<ViewFlipper android:id="@+id/itemdetail_gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ViewFlipper>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/btn_gallery_prev"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/bg_diapo_left"
android:layout_marginLeft="5dp"
android:layout_width="30dp"
android:layout_height="50dp" android:visibility="gone" />
<ImageView android:id="@+id/btn_gallery_next"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/bg_diapo_right"
android:layout_marginRight="5dp"
android:layout_width="30dp"
android:layout_height="50dp" android:visibility="gone" />
<TextView android:id="@+id/btn_gallery_ind"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/bg_diapo_ind"
android:gravity="center" android:layout_width="30dp"
android:layout_height="20dp" android:visibility="gone" />
</RelativeLayout>
开发者_如何学Python </RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Default orientation for a LinearLayout
is horizontal. The ScrollView
is being placed next to the RelativeLayout
. Since you have android:layout_width="fill_parent"
your ScrollView
is never being shown. If you want your layout to be vertical then you need to set is as so. Try setting android:orientation="vertical"
in your LinearLayout
.
精彩评论