【发布时间】:2012-04-05 17:01:45
【问题描述】:
可能重复:
How can I put a ListView into a ScrollView without it collapsing?
我正在尝试将食物菜单设置为可滚动的,但是一旦我添加它,它就会变成图像中的样子。在我添加滚动视图之前,我无法在屏幕上查看我的后退按钮,即使我已经添加了它。这是我奇怪的代码。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/foodbg"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="@+id/backToMenu"
android:text="Back" >
</Button>
</LinearLayout>
【问题讨论】:
-
尝试修复 wrap_content 的按钮 instad
-
移除scrollview并尝试使用listview的setFooter和不同的布局xml文件,那里有按钮。