我有一个视图,其中包含几个textViews一个ImageView和一个按钮。因为在小屏幕设备上(或在大屏幕上的横屏模式下)并不是全部都可见,所以我使用Scroll作为整个层级的父级,以允许用户查看所有信息。事情很糟糕,按钮必须位于视图的底部。然而,在大屏幕设备上,在按钮上留有足够的空间时,该按钮将立即放置在最后一个文本视图的下方,并且似乎占据了所有剩余空间(导致视图不协调)。尝试使用android:allignParentButtom =“true”,不仅仅是它没有效果,而是将按钮置于屏幕顶部。有没有人有任何想法我怎么能够完成我所描述的?ScrollView在android
这里的XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<RelativeLayout
android:id="@+id/gps_info_page1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/itsDateTimeValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="@string/eStrUnknown">
</TextView>
<RelativeLayout
android:id="@+id/directions"
android:layout_centerHorizontal="true"
android:layout_below="@+id/itsDateTimeValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/itsDirectionValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:layout_marginRight="2dip"
android:textSize="20sp">
</TextView>
<TextView
android:id="@+id/itsOrientation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginLeft="2dip"
android:text="@string/eStrUnknown"
android:layout_toRightOf="@+id/itsDirectionValue">
</TextView>
</RelativeLayout>
<ImageView
android:id="@+id/itsImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/compass"
android:layout_below="@+id/directions"
android:layout_centerHorizontal="true">
</ImageView>
<RelativeLayout>
..."TextViews below the above image"
</RelativeLayout>
<RelativeLayout>
..."TextViews below the above"
</RelativeLayout>
<RelativeLayout>
..."TextViews below the above"
</RelativeLayout>
<RelativeLayout>
..."TextViews below the above"
</RelativeLayout>
<RelativeLayout
..."TextViews below the above"
</RelativeLayout>
<LinearLayout
android:id="@+id/div"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_below="@+id/sunset_layout"
android:background="#F333">
</LinearLayout>
<Button //adding here android:alignParentBottom="true" has described above behavior
android:layout_marginBottom="3dip"
android:layout_marginTop="20dip"
android:id="@+id/done_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/eStrDone"
android:textSize="18sp"
android:layout_below="@+id/div"
android:layout_centerHorizontal="true">
</Button>
</RelativeLayout>
</ScrollView>
只是要清楚,你想这样的事情?:http://tinyurl.com/3azuawt – 2010-06-09 19:41:35