2017-08-07 56 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"

希望這會有所幫助。