2012-08-23 92 views
0

我有一個佈局,我需要在屏幕上顯示一個webview。我給自己定的佈局並在圖形佈局在Eclipse中,它看起來像我想,像這樣(徽標和抽穗期塗黑):Android webview全屏

Layout as shown in the Graphical Layout

然而,當我在打開這個佈局模擬器或電話上,它將WebView顯示爲全屏。我如何製作這樣的佈局?任何幫助深表感謝!

這裏是我的XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/Theme.KB_default" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/header_background_shape" > 
     <TextView 
      android:id="@+id/heading" 
      style="@style/Theme.KB_header" 
      android:layout_width="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:text="@string/app_name" > 
     </TextView> 
     <ImageView 
      android:id="@+id/imageViewPadlock" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="10dp" 
      android:contentDescription="@string/global_secure_connection" 
      android:src="@drawable/padlock" /> 
    </RelativeLayout> 
    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:background="@color/black" > 
    </View> 
    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.41" 
     android:orientation="vertical" > 
     <WebView 
     android:id="@+id/webview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 
     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="40dp" 
      android:layout_height="20dp" 
      android:layout_marginBottom="5dp" 
      android:layout_marginLeft="15dp" 
      android:contentDescription="@string/global_logo" 
      android:scaleType="fitXY" 
      android:src="@drawable/logo_transparrent_notext" /> 
    </LinearLayout> 
</LinearLayout> 

回答

0

好吧,我好像是活着的愚蠢傢伙。我的佈局工作,但我忘了添加「setContentView(xml.file);」所以它從來沒有加載XML ......愚蠢的