Ich bin am Anfang mit Android und das ist meine App. Ich habe eine Radio-Gruppe auf der Unterseite eingefügt, um eine halbtransparente Bar mit vier Tasten zu bauen, und was ich Sie fragen ist, wie kann ich sie zentrieren?
und das ist mein Layout xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context=".MainActivity" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.91" />
<RadioGroup
android:id="@+id/radio_group_list_selector"
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal"
android:background="#80000000"
android:padding="4dp"
android:layout_gravity="bottom">
<ImageButton
android:id="@+id/buttonmuseum"
android:layout_width="40dp"
android:layout_height="40dp"
android:text=""
android:layout_gravity="center"
android:background="@drawable/museum"/>
<View
android:id="@+id/VerticalLine"
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#aaa" />
<ImageButton
android:id="@+id/buttonhotel"
android:layout_width="40dp"
android:layout_height="40dp"
android:text=""
android:layout_gravity="center"
android:background="@drawable/hotel" />
<View
android:id="@+id/VerticalLine1"
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#aaa" />
<ImageButton
android:id="@+id/buttonrestaurant"
android:layout_width="40dp"
android:layout_height="40dp"
android:text=""
android:layout_gravity="center"
android:background="@drawable/restaurant" />
<View
android:id="@+id/VerticalLine2"
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#aaa" />
<ImageButton
android:id="@+id/buttonsouvenir"
android:layout_width="40dp"
android:layout_height="40dp"
android:text=""
android:layout_gravity="center"
android:background="@drawable/souvenir"/>
</RadioGroup>
</FrameLayout>
Irgendwelche Vorschläge werden akzeptiert. Ich danke dir sehr.
PS .: Ich habe das rote Quadrat nur mit Farbe gestaltet, um Ihnen das interessierende Gebiet besser zu zeigen.
Antworten:
2 für die Antwort № 1Probieren Sie diese Ergänzung im Radiogroup-Tag aus
android:gravity="center"