2013-02-28 61 views
0

我想要一個搜索區域和一個ListView到兩個ScrollView的佈局。ScrollView減少我的ListView

但是ListView控件不填充佈局> <

代碼:

<?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>  
+0

刪除滾動視圖。正如黑帶所說,listview有自己的滾動功能。 – Raghunandan 2013-02-28 14:51:52

+0

但是當我向下滾動時,我希望整個佈局下降。 – 2013-02-28 16:12:10

+0

如果我設置ListView的高度(android:layout_height =「500dp」),它可以像我想要的那樣工作,但它可以在底部有一些空的空間。 – 2013-02-28 16:13:18

回答

1

你不能把一個ListView一個ScrollView內。 ListView有它自己的滾動。