listview下加一个button为什么button显不出来啊<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:orientation="vertical"
    >    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/text"
        android:text="@string/text"
       />
    <ListView 
        
         android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/list1"
       android:dividerHeight="1sp"
         />
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/button"/>
</LinearLayout>

解决方案 »

  1.   

    用相对布局RelativityLayout试试,Button放在底部
      

  2.   

    你这样写布局应该是android在layout时候无法得到你Listview高度(动态加载的)导致的,楼上说的可以试下,应该可以
      

  3.   

    继续用LinearLayout呢?加给ListView
      

  4.   

    给ListView指定一个高度或者android:maxHeight属性试一下
      

  5.   

    给listview加个属性android:layout_weight="0.1"
      

  6.   

     <ListView  
         android:layout_weight="1"
      

  7.   

      <Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:id="@+id/button"
    android:layout_weight="1"
    />
    这么修改看看
      

  8.   

    <?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"
        android:background="#ffffff" 
        >
        
        <ListView 
        android:id="@+id/listView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button1"
        ></ListView>
        

        
                <Button
                android:id="@+id/button1"
                android:layout_width="fill_parent"
                android:layout_height="48dp"
        android:layout_alignParentBottom="true"
                android:text="回复" />

    </RelativeLayout>
      

  9.   

    相对布局,button按钮用android:layout_alignParentBottom="true"这个属性放在底部,
    listview设置android:layout_above="@+id/button1"属性放在button上面,就ok了。
      

  10.   

    因为你的ListView没有设背景颜色,而且最好把高度改为:0dip 这样就可以了!
    <ListView
            android:id="@+id/list1"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="0.25"
            android:background="#00ff00"
             />
      

  11.   

    给button加上android:text属性试一试