Android布局与Gallery下方的RelativeLayout不正确显示?
我有一个这样的布局:Android布局与Gallery下方的RelativeLayout不正确显示?,android,layout,gallery,android-relativelayout,Android,Layout,Gallery,Android Relativelayout,我有一个这样的布局: <ScrollView android:id="@+id/ScrollViewHome" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" android:fillViewport="true" > <LinearLayout android:
<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>
它会在屏幕中央展示我的画廊。画廊上方和下方都有空白,因为图像的高度不适合整个屏幕。没关系。然后我想在多媒体资料下方添加2个文本视图:
<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>
添加<代码> <代码>后,画廊上方和下方的空白空间变大。而
内的2文本视图未显示。屏幕上仍然只有画廊。为什么?我写错什么了吗?请帮我解决这个问题。在滚动视图中将方向垂直于线性布局。这可能是一个原因。将线性布局更改为垂直布局
<LinearLayout
android:id="@+id/contentOuter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal" android:orientation="vertical">
完美。你救了我一天。我能问一下为什么我们要把方向垂直于线性布局吗?另一个问题是,现在显示的是2 TextView,但它们都是左对齐的。我已经设置了其中的1个,但是为什么它不工作呢?它是唯一一个将其子项安排在一列或一行中的布局…将android:layout\u width=“fill\u parent”替换为android:layout\u width=“wrap\u content”在你们的两个文本视图中,你们也是对的,但湿婆K会先给出答案,所以我会把他的答案设为答案,然后投票给你们。谢谢另一个问题是,现在显示的是2 TextView,但它们都是左对齐的。我已经设置了其中1个android:layout\u alignParentRight=“true”但为什么它不工作?您想垂直或水平设置它?