2011-02-13 49 views
0

我正在嘗試創建一個瀏覽器應用程序,現在我正在嘗試創建佈局 - 基本上,這是一個EditText(作爲地址欄),WebView和酒吧底部。出現無法打開底部欄的問題。這裏是我的main.xmlAndroid:使用xml佈局問題

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <EditText 
      android:id="@+id/addressbar" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:drawable/editbox_background" /> 

    <com.android.ibrowser.myWebView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/browser" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" /> 

     <View xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/downBar" 
      android:layout_width="fill_parent" 
      android:layout_height = "60px" /> 
</LinearLayout> 

你怎麼看?

回答

0

使具有屬性layout_weight設置爲"1"和你在底部欄應該出現

+0

感謝的人,它的工作...但是你可以解釋layout_weight如何影響你的佈局的WebView?謝謝。 – Alex1987

+0

如果多個佈局元素的高度或寬度設置爲'fill_parent',則使用'layout_weight'。使用此元素的另一種情況是在寬度(高度)設置爲「fill_parent」的元素之後放置一個元素,並將下一個元素從屏幕上剝離。使用'layout_weight',您可以輕鬆管理與屏幕無關的元素大小。 –