2017-08-07 61 views
0

在渲染它之后创建相对布局后,我发现布局下面有空间不需要。我确保所使用的元素的所有高度都有一个wrap_content属性作为高度的规格参数。 下面是摘录关闭相关布局底部的空白

<RelativeLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:background="#338FD8D8"> 

      <TextView 
        android:id="@+id/banner" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical|center" 
        android:textSize="25sp" 
        android:padding="3px" 
        android:textColor="#000"/> 
      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:orientation="horizontal"> 

       <ImageView 
        android:id="@+id/logo" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="0.1" 
        android:layout_gravity="left" 
        android:src="@drawable/ic_launcher" /> 
       <TextView 
        android:id="@+id/description" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical|right" 
        android:textSize="15sp" 
        android:padding="3px" 
        android:layout_marginRight="100px" 
        android:textColor="#000"/> 
      </LinearLayout> 

     </RelativeLayout> 

我的挑战是如何关闭,下面的最后内容

+0

为什么不为最外层的RelativeLayout做'layout_height = match_parent'?这肯定会填补你的空白 – 0xDEADC0DE

+0

它没有工作 – blend

+1

'它没有工作'不是真正的描述。你还有差距吗?你遇到了不同的布局问题吗?分享一些截图可能也有帮助 – 0xDEADC0DE

回答

0

不知道你正在努力实现的正是布局内发生的差距,但你可以改变你RelativeLayout的高度

机器人:layout_height = “match_parent”

而且甲肝请参阅docs以了解android:fitsSystemWindows="true"

希望这会有所帮助。