2012-07-11 66 views
0

我目前遇到了看似簡單的佈局問題。我有一個靜態頭(帶有標誌和按鈕),一個WebView,然後是一個靜態頁腳(帶有中心按鈕)。這些3之間似乎有一個空格,我無法刪除(我將根背景設爲紅色,因此很明顯空間在哪裏)。Android版面差距問題

任何想法如何讓WebView填充整個空間,這樣紅色的背景消失了?

而且Eclipse是給我以下警告我的RelativeLayout塊:

這RelativeLayout的佈局或它的LinearLayout父可能是無用的;背景屬性轉移到另一種觀點

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/commonlayout" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FF0000" 
    android:orientation="vertical" 
    android:padding="0dp" 
    android:weightSum="10" > 

    <LinearLayout 
     android:id="@+id/llheader" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" > 

     <RelativeLayout 
      android:id="@+id/relativeLayout1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="top" 
      android:background="@drawable/bgx" > 

      <Button 
       android:id="@+id/Button_logout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_centerVertical="true" 
       android:layout_marginRight="2dp" 
       android:background="@drawable/ic_launcher" /> 

      <Button 
       android:id="@+id/Button_playlist" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_centerVertical="true" 
       android:layout_marginLeft="2dp" 
       android:background="@drawable/logo" /> 
     </RelativeLayout> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/lldata" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="8" 
     android:background="#00FF00" > 

     <WebView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/webview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/llfooter" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_margin="0dp" 
     android:layout_weight="1" 
     android:gravity="center" 
     android:orientation="horizontal" 
     android:visibility="visible" > 

     <RelativeLayout 
      android:id="@+id/relativeLayout2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:background="@drawable/bgx" > 

      <Button 
       android:id="@+id/issue" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:background="@drawable/ic_launcher" 
       android:textColor="#FFFFFF" /> 
     </RelativeLayout> 
    </LinearLayout> 

</LinearLayout> 

enter image description here

回答

0

任何想法,我怎麼能做出的WebView填補這一整個空間因此這個紅色 背景到哪裏去了?

您應該嘗試在webview佈局中使用權重標記1。

或刪除webview的佈局父項,並直接使用webview與權重1.