How can I focus my button on the radio group?

I am at the beginning with Android and this is my application. I have inserted a radio group at the bottom to build a semi-transparent panel with four buttons, and what I ask of you, how can I center them?

my app

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 very much.

PS: I designed a red paint square to better show you the area of ​​interest.

+3


source to share


1 answer


try adding the following to the radio group tag



android:gravity="center"

      

+2


source







All Articles