Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:45:32+00:00 2026-06-12T19:45:32+00:00

In the XML to follow, each RadioButton is set to android:gravity=center . All three

  • 0

In the XML to follow, each RadioButton is set to android:gravity="center".

All three buttons show up, but the button descriptions are centered. The buttons themselves are not. How do I center the buttons as well as their descriptions?

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center"
            android:text="RadioButton" />

        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center"
            android:checked="true"
            android:text="RadioButton" />

        <RadioButton
            android:id="@+id/radio2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center"
            android:text="RadioButton" />
    </RadioGroup>
</LinearLayout>

In this picture, you can ignore the top bar. That’s already been coded in. What I’m seeing is the RadioButtons far to the right of the “RadioButton” text (the button itself is up against the layout bounds). The desired end result is, since I can’t post images: Here it is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:45:33+00:00Added an answer on June 12, 2026 at 7:45 pm

    I have tried editing your layout to do what is in your screenshot. I don’t think this is an efficient way to do this but this is the only way that worked for me.

    I inserted every radiobutton inside a parent linerlayout, and then used gravity center.

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center" >
    
            <RadioButton
                android:id="@+id/radio1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="RadioButton" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center" >
    
            <RadioButton
                android:id="@+id/radio0"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="true"
                android:text="RadioButton" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".3"
            android:gravity="center" >
    
            <RadioButton
                android:id="@+id/radio2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="RadioButton" />
        </LinearLayout>
    </RadioGroup>
    

    I really hope there’s a better solution than this. But here, hope it helps. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying parse the follow XML file: <root>Root <pai>Pai_1 <filho>Pai1,Filho1</filho> <filho>Pai1,Filho2</filho> </pai> <pai>Pai_2 <filho>Pai2,Filho1</filho>
I have a requirement to return xml as follow <row id=1> <cell>1</cell> <cell>setup/pagemst</cell> <cell>Page
One can create a SeekBar in XML as follows... <SeekBar xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/bpseekbar android:layout_width=fill_parent android:layout_height=wrap_content
I have an XML document that has several <item> elements. Inside each, there might
I want to place each character on new line. I am using following xml.
I'm trying to do an autocomplete to my textbox, but it doesn't work. Follow
So I'm trying to follow this tutorial... to learn android, and I'm having a
I have an app that works correctly on Android and iOS, but currently fails
I have xml as follows <Search> <Term /> <And /> <Term /> <And />
I have an XML string as follows: <?xml version=1.0 encoding=utf-8?> <document id=0 name=RegSimple Version=0.1>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.