不管其他内容如何让按钮和其他内容保持固定在屏幕底部?在Android屏幕底部固定内容
我有这样一个布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:gravity="center_horizontal" >
<TextView ... />
...
<TextView ... />
</LinearLayout>
<Button
android:id="@+id/ButtonMain"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:text="@string/button_text"
android:textSize="30px"
android:textStyle="bold"
android:width="200px" />
</LinearLayout>
</ScrollView>
而且我想ButtonMain的底部总是在屏幕的底部。但是,该按钮呈现在线性布局内容的正下方,而不是在屏幕的底部。我试过layout_gravity="center_horizontal|bottom"
,以及将按钮放置在自己的LinearLayout中,具有类似的重力,但是这不起作用。
我该如何实现这种布局?
您是否试图静态渲染屏幕底部的'Button',尽管有'ScrollView'? – Eric 2012-07-31 19:17:33
@Eric,确实。当我尝试将按钮放在ScrollView之外时,我收到了很多错误。 – Cerin 2012-07-31 20:20:07