I'm at the beginning with android and this is my app. I inserted a radio group on the bottom to build a semi-transparent bar with four buttons, and what I ask to you is, how can I center them?
and this is my 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>
Any suggestions are accepted. Thank you so much.
PS: I designed the red square with paint only to show better the interested area to you.
尝试在radiogroup标签中添加以下内容
android:gravity="center"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.