2012-07-11 44 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.