我很困惑。我想要顯示地圖並在地圖下方顯示5個按鈕。我使用RelativeLayout,但程序只顯示產品按鈕。爲什麼?我很困惑我使用哪種佈局(線性,相對,框架或絕對)!請幫幫我。以及如何更正此代碼?我應該使用哪種佈局?
location.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frame"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:apiKey="0cPRv243zM1_S3ydsNg8MJP9_6BfCp642jOhPvQ"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"
android:layout_gravity="bottom"
android:orientation="horizontal" >
<Button
android:id="@+id/button_home"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/home_icon"
android:text="@string/button_home"
android:textColor="@color/text_home" />
<Button
android:id="@+id/button_product"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/product_icon"
android:onClick="Product"
android:text="@string/button_product"
android:textColor="@color/text_product" />
</LinearLayout>
</LinearLayout>
我建議你從我的經驗中使用線性佈局。 –
它修復了您必須在地圖下方添加5個按鈕。或其動態? –