0

在我决定添加滚动视图之前,我的布局是完美的。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
    <ScrollView android:id="@+id/scrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" >
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/linearLayout1">
            <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tableLayout1"/>
        </LinearLayout>
    </ScrollView>
    <Button android:layout_width="match_parent" android:id="@+id/button1" android:text="Start" android:layout_height="50dip" android:onClick="getOutput"></Button>
</TableLayout>

我希望按钮留在屏幕底部,实际上我希望滚动视图占据整个屏幕。仅使用内部表格布局就可以正常工作。在图形布局预览中,它看起来像我想要的那样,但不是在我运行它时。

我希望滚动视图占据整个屏幕,除了按钮,我想在底部。

4

3 回答 3

1

您可以使用 RelativeLayout 或 LinearLayout 作为 Root 视图。给巴顿更多的重量。这样 ScrollView 不会占用整个事情。

于 2011-09-09T03:54:00.860 回答
0

尝试将 ScrollView fillViewport 属性设置为 true。

于 2011-09-09T03:51:34.457 回答
0

这应该工作

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:orientation="vertical">
    <ScrollView  android:layout_width="fill_parent" android:layout_height="0dip" 
        android:layout_weight="1.0">
        <LinearLayout android:layout_width="fill_parent" 
            android:layout_height="fill_parent" android:orientation="vertical" 
            android:id="@+id/linearLayout1"> 
            <TableLayout android:layout_width="fill_parent" 
                android:layout_height="fill_parent" 
                android:id="@+id/tableLayout1"/> 
        </LinearLayout>
    </ScrollView>
    <Button android:layout_width="fill_parent" android:layout_height="wrap_content" 
        android:text="Bottom Button"/>
</LinearLayout>
于 2011-09-09T04:03:01.687 回答