首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

layout格局奇怪现象

2013-07-25 
layout布局奇怪现象中间这一大块的布局 是一个水平LinearLayout有两个子 Relative width都是1所有的layout

layout布局奇怪现象
layout格局奇怪现象
中间这一大块的布局 是一个水平LinearLayout
有两个子 Relative width都是1
所有的layout_height 都是wrap_content
为什么 会有这么一块白色的?
具体代码


        >

        <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
[解决办法]
你指的白色是你选中的那部分么??

这整个布局都有问题,你的这个相对布局所有的都是从下往上排的,你一上来就指定了最下面的沉底了
            <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"
其他的都是在这个控件的上面,没有铺满的情况下自然就留出一片空白了

热点排行