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 6782843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:47:32+00:00 2026-05-26T16:47:32+00:00

I have a radio group with two radiobuttons. each button has a custom selector.

  • 0

I have a radio group with two radiobuttons. each button has a custom selector. I would like for the drawable in the selector to fill out the width of the radio button. Under different resolutions the button looks different. I am not using a nine-patch so this makes sense but even if i was I am not sure how to make the button drawable stretch. Below is the code for the radio group and a selector. widths are different from fiddling around.

The layout xml:

            <RadioButton
                android:id="@+id/radiomale"
                android:layout_width="126dp"
                android:layout_height="50dp"
                android:minHeight="50dp"
                android:minWidth="126dp"
                android:button="@layout/signupmale"

                />

            <RadioButton
                android:id="@+id/radiofemale"
                 android:layout_width="128dp"
                android:layout_height="50dp"
                android:minHeight="50dp"
                android:minWidth="128dp"
                android:button="@layout/signupfemale" />
        </RadioGroup>

The Selector:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_window_focused="false"
    android:drawable="@drawable/genre_male_pressed" />
<item android:state_checked="false" android:state_window_focused="false"
    android:drawable="@drawable/genre_male" />
<item android:state_checked="true" android:state_pressed="true"
    android:drawable="@drawable/genre_male_pressed" />
<item android:state_checked="false" android:state_pressed="true"
    android:drawable="@drawable/genre_male" />
<item android:state_checked="true" android:state_focused="true"
    android:drawable="@drawable/genre_male_pressed" />
<item android:state_checked="false" android:state_focused="true"
    android:drawable="@drawable/genre_male" />
<item android:state_checked="false" android:drawable="@drawable/genre_male" android:scaleType="fitXY" />
<item android:state_checked="true" android:drawable="@drawable/genre_male_pressed" android:scaleType="fitXY"/>
</selector>

The problem is when testing under different resolutions gaps form between the buttons. Thanks for any help.

  • 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-05-26T16:47:33+00:00Added an answer on May 26, 2026 at 4:47 pm

    RadioGroup is actually a subclass of LinearLayout so what you could do is use layout_weight of the children to control the spacing. This might be a little helpful: Linear Layout and weight in Android
    and this Android layout_weight comportment

        <RadioGroup
            android:layout_width="match_parent"
            android:layout_height="45dip"
            android:weightSum="1"
            android:orientation="horizontal"
            >
    
            <RadioButton
                android:layout_width="match_parent"
                android:layout_height="40dip"
                android:layout_weight=".5"
                />
    
            <RadioButton
                android:layout_width="match_parent"
                android:layout_height="40dip"
                android:layout_weight=".5"
                />
    
        </RadioGroup>
    

    You are going to need to use ninepatch and maybe use padding left or right if there is text on the radio buttons.

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

Sidebar

Related Questions

I have six radio buttons in XAML, and I would like to create two
So I have a Radio button group, like so: <div data-role=fieldcontain> <fieldset data-role=controlgroup> <legend>Choose
I have a radio button group on a survey form whose html looks like:
I have a group of three radio buttons. Depending on which radio button is
I have a form with a lot of groups of radios. Each radio has
I have a / group of radio buttons , and a CommandButton Two cases
I have two Ext.menu.CheckItem's in a group. How would I change the checked item's
I have two radio buttons, in the same group name, users selects either one
i have a form with a radio button group(6 radio buttons), id's are r1,r2,r3,r4,r5,r6
I have two radio buttons in one group, I want to check the radio

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.