Android ScrollView减少我的ListView
我想把一个带有搜索区域和列表视图的布局变成一个滚动视图Android ScrollView减少我的ListView,android,android-layout,scrollview,Android,Android Layout,Scrollview,我想把一个带有搜索区域和列表视图的布局变成一个滚动视图 但是ListView不能填充布局>您不能将ListView放在滚动视图中。ListView有自己的滚动功能。找到了解决方案,如下所示: 对我来说很好删除滚动视图。正如blackbelt所说,listview有自己的滚动。但我希望在向下滚动时整个布局都会向下。如果我设置listview的高度(android:layout_height=“500dp”),它可以像我所希望的那样工作,但底部可能有一些空白。使用listview的layoutwei
但是ListView不能填充布局>您不能将
ListView
放在滚动视图中。ListView有自己的滚动功能。找到了解决方案,如下所示:
对我来说很好删除滚动视图。正如blackbelt所说,listview有自己的滚动。但我希望在向下滚动时整个布局都会向下。如果我设置listview的高度(android:layout_height=“500dp”),它可以像我所希望的那样工作,但底部可能有一些空白。使用listview的layoutweight。它将填充底部的空间。我没有收到你的通讯网,但我希望整个布局都向下滚动,如果我删除滚动视图,搜索区域将固定在顶部,我不希望这样。向下滚动时,搜索区域应消失。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/edt_procura_cliente"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:ems="10" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2.3"
android:lines="1"
android:text="Procurar" />
</LinearLayout>
<ListView
android:id="@+id/list_clientes_visitas"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</LinearLayout>
</ScrollView>
</RelativeLayout>