中间这一大块的布局 是一个水平LinearLayout
有两个子 Relative width都是1
所有的layout_height 都是wrap_content
为什么 会有这么一块白色的?
具体代码<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="true"
    android:gravity="center_horizontal"
    android:orientation="vertical" ><LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true"
    android:gravity="center_horizontal"
    android:orientation="vertical">
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >        <ImageView
            android:id="@+id/imageView_share_popup_window_SHareTo"
            android:layout_width="20dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="5dp"
            android:background="#20B2AA"/>        <TextView
            android:id="@+id/textView_share_popup_window_ShareTo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="分享到" 
            android:textSize="20sp"/>    </LinearLayout>    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:layout_weight="1">
<Button
                android:id="@+id/button_share_popup_window_Sina"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_above="@+id/textView_share_popup_window_Sina"/>
<TextView
                android:id="@+id/textView_share_popup_window_Sina"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="新浪微博" 
                android:layout_alignLeft="@+id/button_share_popup_window_Sina"
                android:layout_above="@+id/button_share_popup_window_Tencent"/>  
<Button
                android:id="@+id/button_share_popup_window_Tencent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_centerHorizontal="true"
                android:layout_above="@+id/textView_share_popup_window_Tencent"
                android:layout_marginTop="20dp"/>
            <TextView
                android:id="@+id/textView_share_popup_window_Tencent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="腾讯微博"
                android:layout_alignLeft="@+id/button_share_popup_window_Tencent"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="20dp" />        </RelativeLayout>        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" >            <Button
                android:id="@+id/button_share_popup_window_Qzone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_above="@+id/textView_share_popup_window_Qzone"/>
<TextView
                android:id="@+id/textView_share_popup_window_Qzone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="QQ空间" 
                android:layout_alignLeft="@+id/button_share_popup_window_Qzone"
                android:layout_above="@+id/button_share_popup_window_Renren"/>  
<Button
                android:id="@+id/button_share_popup_window_Renren"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_centerHorizontal="true"
                android:layout_above="@+id/textView_share_popup_window_Renren"
                android:layout_marginTop="20dp"/>
            <TextView
                android:id="@+id/textView_share_popup_window_Renren"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="人人网"
                android:layout_alignLeft="@+id/button_share_popup_window_Renren"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="20dp" />
        </RelativeLayout>    </LinearLayout>    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >        <Button
            android:id="@+id/button_share_popup_window_Cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="取消" />    </RelativeLayout>
</LinearLayout>
</RelativeLayout>
布局Android

解决方案 »

  1.   

    你指的白色是你选中的那部分么??这整个布局都有问题,你的这个相对布局所有的都是从下往上排的,你一上来就指定了最下面的沉底了
                <TextView
                    android:id="@+id/textView_share_popup_window_Renren"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="人人网"
                    android:layout_alignLeft="@+id/button_share_popup_window_Renren"
                    android:layout_alignParentBottom="true"
                    android:layout_marginBottom="20dp" />                android:layout_alignParentBottom="true"
    其他的都是在这个控件的上面,没有铺满的情况下自然就留出一片空白了
      

  2.   

    可是relative不是设为高度、、wrap content吗
      

  3.   

    可是relative不是设为高度、、wrap content吗

    是包裹内容啊,可是你让它在父窗口的底部了                  android:layout_alignParentBottom="true"
    其他的空间是从下往上排的,建议你把两个相对布局改成线性布局,把android:layout_alignParentBottom="true"这句话都去掉
      

  4.   

    可是relative不是设为高度、、wrap content吗

    是包裹内容啊,可是你让它在父窗口的底部了                  android:layout_alignParentBottom="true"
    其他的空间是从下往上排的,建议你把两个相对布局改成线性布局,把android:layout_alignParentBottom="true"这句话都去掉
    谢谢了,问题最后是改relative的height为固定大小,就好了