在我的android應用程序中,我有兩個按鈕,位於一行上方,並顯示一張地圖。我希望每個按鈕佔據一半的行。誰能告訴我該怎麼做?我如何設置按鈕來填充每一行?
目前我的代碼是:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btnProgram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Program" />
<Button
android:id="@+id/btnAfisareStatii"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Afisaza toate statiile"
android:layout_toRightOf="@+id/btnProgram"/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/btnAfisareStatii" />
<WebView
android:id="@+id/webview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/webview" />
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0ws8opHdf-pIbZUa916nju81kSSlPRK4Wbg_0vg"
android:clickable="true"
android:enabled="true"
android:layout_above="@id/btnProgram">
</com.google.android.maps.MapView>
</RelativeLayout>
我有一個錯誤在該行按鍵
weight
屬性:機器人:layout_width = 「match_parent」。錯誤是:錯誤:錯誤:字符串類型不允許(在'layout_width'值'match_parent')。 – Andreea 2012-04-25 12:22:04然後放入fill_parent。這兩個值意味着相同,但fill_parent從API版本8起重新命名爲match_parent。 – Renard 2012-04-25 12:23:13
仍然不適合我。我收到一個錯誤,如下所示:應用程序意外停止 – Andreea 2012-04-25 12:27:40