how to put the text on the left of a radio button in android












44















I want to put the text of a radio button on the left not on the right



I found this solution



        <RadioGroup
android:id="@+id/radios"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="right"
android:inputType="text"
android:orientation="vertical" >

<RadioButton
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@color/white"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="first"
android:textColor="@color/Black"
android:textSize="20dip" />

<RadioButton
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Black"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="second"
android:textColor="@color/White"
android:textSize="20dp" />

<RadioButton
android:id="@+id/third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Maroon"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="third"
android:textColor="@color/Vanilla"
android:textSize="20dp" />
</RadioGroup>


but the problem is that the text gravity will be at the left what I want is to put it to right because i'm writing Arabic words



enter image description here










share|improve this question























  • Try with android:drawableLeft="@android:drawable/btn_radio"

    – Pratik Dasa
    Sep 20 '13 at 10:48











  • it doesn't work

    – BasILyoS
    Sep 20 '13 at 10:56






  • 4





    For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

    – Muhammad Adil
    Jun 24 '16 at 18:50
















44















I want to put the text of a radio button on the left not on the right



I found this solution



        <RadioGroup
android:id="@+id/radios"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="right"
android:inputType="text"
android:orientation="vertical" >

<RadioButton
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@color/white"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="first"
android:textColor="@color/Black"
android:textSize="20dip" />

<RadioButton
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Black"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="second"
android:textColor="@color/White"
android:textSize="20dp" />

<RadioButton
android:id="@+id/third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Maroon"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="third"
android:textColor="@color/Vanilla"
android:textSize="20dp" />
</RadioGroup>


but the problem is that the text gravity will be at the left what I want is to put it to right because i'm writing Arabic words



enter image description here










share|improve this question























  • Try with android:drawableLeft="@android:drawable/btn_radio"

    – Pratik Dasa
    Sep 20 '13 at 10:48











  • it doesn't work

    – BasILyoS
    Sep 20 '13 at 10:56






  • 4





    For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

    – Muhammad Adil
    Jun 24 '16 at 18:50














44












44








44


7






I want to put the text of a radio button on the left not on the right



I found this solution



        <RadioGroup
android:id="@+id/radios"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="right"
android:inputType="text"
android:orientation="vertical" >

<RadioButton
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@color/white"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="first"
android:textColor="@color/Black"
android:textSize="20dip" />

<RadioButton
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Black"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="second"
android:textColor="@color/White"
android:textSize="20dp" />

<RadioButton
android:id="@+id/third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Maroon"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="third"
android:textColor="@color/Vanilla"
android:textSize="20dp" />
</RadioGroup>


but the problem is that the text gravity will be at the left what I want is to put it to right because i'm writing Arabic words



enter image description here










share|improve this question














I want to put the text of a radio button on the left not on the right



I found this solution



        <RadioGroup
android:id="@+id/radios"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="right"
android:inputType="text"
android:orientation="vertical" >

<RadioButton
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@color/white"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="first"
android:textColor="@color/Black"
android:textSize="20dip" />

<RadioButton
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Black"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="second"
android:textColor="@color/White"
android:textSize="20dp" />

<RadioButton
android:id="@+id/third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Maroon"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="third"
android:textColor="@color/Vanilla"
android:textSize="20dp" />
</RadioGroup>


but the problem is that the text gravity will be at the left what I want is to put it to right because i'm writing Arabic words



enter image description here







android radio






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 20 '13 at 10:43









BasILyoSBasILyoS

2701615




2701615













  • Try with android:drawableLeft="@android:drawable/btn_radio"

    – Pratik Dasa
    Sep 20 '13 at 10:48











  • it doesn't work

    – BasILyoS
    Sep 20 '13 at 10:56






  • 4





    For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

    – Muhammad Adil
    Jun 24 '16 at 18:50



















  • Try with android:drawableLeft="@android:drawable/btn_radio"

    – Pratik Dasa
    Sep 20 '13 at 10:48











  • it doesn't work

    – BasILyoS
    Sep 20 '13 at 10:56






  • 4





    For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

    – Muhammad Adil
    Jun 24 '16 at 18:50

















Try with android:drawableLeft="@android:drawable/btn_radio"

– Pratik Dasa
Sep 20 '13 at 10:48





Try with android:drawableLeft="@android:drawable/btn_radio"

– Pratik Dasa
Sep 20 '13 at 10:48













it doesn't work

– BasILyoS
Sep 20 '13 at 10:56





it doesn't work

– BasILyoS
Sep 20 '13 at 10:56




4




4





For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

– Muhammad Adil
Jun 24 '16 at 18:50





For language perspective all you need was one line... that is...(android:layoutDirection="rtl" )..... it is more easier :P

– Muhammad Adil
Jun 24 '16 at 18:50












14 Answers
14






active

oldest

votes


















56














Add android:gravity="right" in each RadioButton as follow..



  <RadioGroup
android:id="@+id/radios"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="right"
android:inputType="text"
android:orientation="vertical" >

<RadioButton
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@color/white"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="first"
android:textColor="@color/Black"
android:textSize="20dip"
android:gravity="right"/>

<RadioButton
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Black"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="second"
android:textColor="@color/White"
android:textSize="20dp"
android:gravity="right"/>

<RadioButton
android:id="@+id/third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/Maroon"
android:button="@null"
android:drawablePadding="30dp"
android:drawableRight="@android:drawable/btn_radio"
android:text="third"
android:textColor="@color/Vanilla"
android:textSize="20dp"
android:gravity="right" />
</RadioGroup>





share|improve this answer
























  • awesome man. thank you

    – BasILyoS
    Sep 20 '13 at 11:22











  • you welcome....

    – Mukesh Kumar Singh
    Sep 20 '13 at 11:23











  • Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

    – Zordid
    Mar 16 '14 at 19:41






  • 8





    While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

    – rlazo
    Jun 18 '15 at 18:35








  • 7





    android:layoutDirection="rtl" ..... it is more easier :P

    – Muhammad Adil
    Jun 24 '16 at 18:49



















83














Try adding the following attributes into the RadioButton, it should work, this way you still get to keep the ripple effect on the radio button:



            android:layoutDirection="rtl"
android:textAlignment="textStart"
android:layout_gravity="start"


Remember to set supportsRtl property to true in your application manifest.



for eg:



           <RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layoutDirection="rtl"
android:textAlignment="textStart"
android:layout_gravity="start"
android:text="The test item a"
android:textSize="14sp" />

....

</RadioGroup>


would give out:



enter image description here






share|improve this answer





















  • 4





    Give this man a medal! Finally a solution that works. Thx

    – Francois Dermu
    Sep 27 '16 at 19:23






  • 1





    this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

    – jboxxpradhana
    Oct 4 '16 at 13:42











  • android:layoutDirection="rtl" this worked

    – Syed Raza Mehdi
    Dec 28 '16 at 9:48











  • you should use appcompat radiobutton to bypass sdk level limitation

    – user2729200
    Jun 16 '17 at 7:23











  • Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

    – user1202032
    Feb 13 '18 at 8:50



















19














There is property called android:drawableRight which will set your drawable right side of your text and set android:button as null. check below piece of code:



Note: This is sample, you can apply to your all radioButton.



 <RadioButton 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:drawableRight="@android:drawable/btn_radio"
android:text="Left"/>





share|improve this answer
























  • but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

    – Shirish Herwade
    Jan 20 '15 at 18:50



















10














Just add:



android:button="@null"
android:drawableRight="@android:drawable/btn_radio"





share|improve this answer































    9














    Based on the answer of Irshu I suggest the following solution which uses the material ripple effect and produces the following outcome:



    Demo



    If you want the dividers as shown in the GIF than simply add a view with the height of 1 and a background color between the radiobuttons.



    <RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:checkedButton="@+id/radioButton1">

    <RadioButton
    android:id="@+id/radioButton1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:button="@null"
    android:drawableRight="?android:attr/listChoiceIndicatorSingle"
    android:background="?android:selectableItemBackground"
    android:layoutDirection="rtl"
    android:layout_gravity="start"
    android:textAlignment="textStart"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    android:text="Button1"
    android:textSize="14sp" />

    <RadioButton
    android:id="@+id/radioButton2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:button="@null"
    android:drawableRight="?android:attr/listChoiceIndicatorSingle"
    android:background="?android:selectableItemBackground"
    android:layoutDirection="rtl"
    android:layout_gravity="start"
    android:textAlignment="textStart"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    android:text="Button2"
    android:textSize="14sp" />

    <RadioButton
    android:id="@+id/radioButton3"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:button="@null"
    android:drawableRight="?android:attr/listChoiceIndicatorSingle"
    android:background="?android:selectableItemBackground"
    android:layoutDirection="rtl"
    android:layout_gravity="start"
    android:textAlignment="textStart"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    android:text="Button3"
    android:textSize="14sp" />
    </RadioGroup>





    share|improve this answer


























    • Thank you really much!

      – Gabriella Angelova
      Dec 5 '18 at 12:26



















    7














    add this in xml : ( 4.2 and above)



    android:layoutDirection="rtl"


    for older version than 4.2 use ViewCompat from android.support.v4.view:



    ViewCompat.setLayoutDirection(findViewById(R.id.radio_button), ViewCompat.LAYOUT_DIRECTION_RTL);





    share|improve this answer

































      3














      In case anyone is still wondering how to achieve this, here's a better solution in my opinion:
      RadioGroup class extends LineareLayout. You can add a simple radio button and a TextView beside it and easily have the same effect:



      <RadioGroup
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:gravity="center_horizontal"
      android:orientation="horizontal">

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="خانم"/>

      <RadioButton
      android:id="@+id/female"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="20dp"
      />

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="20dp"
      android:text="آقا"/>

      <RadioButton
      android:id="@+id/male"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      />

      </RadioGroup>


      Which then makes a layout like below:



      enter image description here






      share|improve this answer































        3














        Very simple, you want the text to appear in the left of the radio button, you just have to change the layout direction to rtl (== right to left):



        android:layoutDirection="rtl"





        share|improve this answer

































          2














          I've used a trick like the code below to achieve this in all SDKs with default UI and default select behavior:



          <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layoutDirection="ltr"
          android:orientation="vertical"
          android:padding="10dp">

          <RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content">

          <TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_centerVertical="true"
          android:layout_marginRight="30dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:text="RadioButton 1"
          android:textColor="@color/Black" />

          <RadioButton
          android:id="@+id/rb1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:paddingBottom="10dp"
          android:paddingTop="10dp"
          android:scaleX="-1" />
          </RelativeLayout>

          <RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content">

          <TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_centerVertical="true"
          android:layout_marginRight="30dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:text="RadioButton 2"
          android:textColor="@color/Black" />

          <RadioButton
          android:id="@+id/rb2"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:paddingBottom="10dp"
          android:paddingTop="10dp"
          android:scaleX="-1" />
          </RelativeLayout>
          </LinearLayout>


          Now for make the buttons single selectable, just write the code for buttons onCheckedChanged listener and make other buttons unchecked.



          Like this:



          rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
          if(checked)
          rb2.setChecked(false);
          }
          });





          share|improve this answer































            2














            try this code :



                                 <RadioGroup
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:gravity="right">

            <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textDirection="rtl"
            android:layout_margin="4dp"
            android:layoutDirection="rtl"
            android:textAlignment="textStart"
            android:layout_gravity="start"
            android:text="اول"
            android:textSize="15dp"/>
            </RadioGroup>


            result :
            show result






            share|improve this answer





















            • 2





              Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

              – B001ᛦ
              Jun 13 '18 at 10:23



















            1














            try this code and change the values to your arabic words..



            main.xml



            <?xml version="1.0" encoding="utf-8"?>
            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >
            <RadioGroup
            android:id="@+id/radioGender"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <RadioButton
            android:id="@+id/radioMale"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/radio_male"
            android:checked="true" />

            <RadioButton
            android:id="@+id/radioFemale"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/radio_female" />

            </RadioGroup>

            <Button
            android:id="@+id/btnDisplay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btn_display" />

            </LinearLayout>





            share|improve this answer



















            • 1





              oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

              – BasILyoS
              Sep 20 '13 at 11:12



















            1














            Take a look at the "CustomChoiceList" example, there it is explained how you can create either your own check boxes/radio buttons or how you can create a ListView with the default check boxes/radio buttons used in the android settings, for example. You should especially note the res/layout/sample_main.xml file, it expains much.






            share|improve this answer



















            • 3





              Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

              – Sean Connolly
              Jan 19 '14 at 20:40



















            1














                        android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fontPath="@string/font_nunito_light"
            android:text="Male"
            android:layout_marginTop="@dimen/dp_10"
            android:drawablePadding="@dimen/dp_10"
            android:drawableStart="@drawable/selector_radio"
            android:button="@null"
            android:id="@+id/rb_"
            android:checked="true"
            android:textSize="@dimen/sp_15"





            share|improve this answer



















            • 3





              While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

              – blue-phoenox
              May 17 '18 at 9:39



















            0














            to keep material style use android:drawableRight="?android:attr/listChoiceIndicatorSingle"



            <RadioButton
            android:id="@+id/radioButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:button="@null"
            android:text="rtl button"
            android:drawableRight="?android:attr/listChoiceIndicatorSingle"/>





            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18914792%2fhow-to-put-the-text-on-the-left-of-a-radio-button-in-android%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              14 Answers
              14






              active

              oldest

              votes








              14 Answers
              14






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              56














              Add android:gravity="right" in each RadioButton as follow..



                <RadioGroup
              android:id="@+id/radios"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_gravity="right"
              android:inputType="text"
              android:orientation="vertical" >

              <RadioButton
              android:id="@+id/first"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:background="@color/white"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="first"
              android:textColor="@color/Black"
              android:textSize="20dip"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/second"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Black"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="second"
              android:textColor="@color/White"
              android:textSize="20dp"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/third"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Maroon"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="third"
              android:textColor="@color/Vanilla"
              android:textSize="20dp"
              android:gravity="right" />
              </RadioGroup>





              share|improve this answer
























              • awesome man. thank you

                – BasILyoS
                Sep 20 '13 at 11:22











              • you welcome....

                – Mukesh Kumar Singh
                Sep 20 '13 at 11:23











              • Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

                – Zordid
                Mar 16 '14 at 19:41






              • 8





                While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

                – rlazo
                Jun 18 '15 at 18:35








              • 7





                android:layoutDirection="rtl" ..... it is more easier :P

                – Muhammad Adil
                Jun 24 '16 at 18:49
















              56














              Add android:gravity="right" in each RadioButton as follow..



                <RadioGroup
              android:id="@+id/radios"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_gravity="right"
              android:inputType="text"
              android:orientation="vertical" >

              <RadioButton
              android:id="@+id/first"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:background="@color/white"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="first"
              android:textColor="@color/Black"
              android:textSize="20dip"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/second"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Black"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="second"
              android:textColor="@color/White"
              android:textSize="20dp"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/third"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Maroon"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="third"
              android:textColor="@color/Vanilla"
              android:textSize="20dp"
              android:gravity="right" />
              </RadioGroup>





              share|improve this answer
























              • awesome man. thank you

                – BasILyoS
                Sep 20 '13 at 11:22











              • you welcome....

                – Mukesh Kumar Singh
                Sep 20 '13 at 11:23











              • Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

                – Zordid
                Mar 16 '14 at 19:41






              • 8





                While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

                – rlazo
                Jun 18 '15 at 18:35








              • 7





                android:layoutDirection="rtl" ..... it is more easier :P

                – Muhammad Adil
                Jun 24 '16 at 18:49














              56












              56








              56







              Add android:gravity="right" in each RadioButton as follow..



                <RadioGroup
              android:id="@+id/radios"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_gravity="right"
              android:inputType="text"
              android:orientation="vertical" >

              <RadioButton
              android:id="@+id/first"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:background="@color/white"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="first"
              android:textColor="@color/Black"
              android:textSize="20dip"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/second"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Black"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="second"
              android:textColor="@color/White"
              android:textSize="20dp"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/third"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Maroon"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="third"
              android:textColor="@color/Vanilla"
              android:textSize="20dp"
              android:gravity="right" />
              </RadioGroup>





              share|improve this answer













              Add android:gravity="right" in each RadioButton as follow..



                <RadioGroup
              android:id="@+id/radios"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_gravity="right"
              android:inputType="text"
              android:orientation="vertical" >

              <RadioButton
              android:id="@+id/first"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:background="@color/white"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="first"
              android:textColor="@color/Black"
              android:textSize="20dip"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/second"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Black"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="second"
              android:textColor="@color/White"
              android:textSize="20dp"
              android:gravity="right"/>

              <RadioButton
              android:id="@+id/third"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@color/Maroon"
              android:button="@null"
              android:drawablePadding="30dp"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="third"
              android:textColor="@color/Vanilla"
              android:textSize="20dp"
              android:gravity="right" />
              </RadioGroup>






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 20 '13 at 11:12









              Mukesh Kumar SinghMukesh Kumar Singh

              3,84121728




              3,84121728













              • awesome man. thank you

                – BasILyoS
                Sep 20 '13 at 11:22











              • you welcome....

                – Mukesh Kumar Singh
                Sep 20 '13 at 11:23











              • Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

                – Zordid
                Mar 16 '14 at 19:41






              • 8





                While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

                – rlazo
                Jun 18 '15 at 18:35








              • 7





                android:layoutDirection="rtl" ..... it is more easier :P

                – Muhammad Adil
                Jun 24 '16 at 18:49



















              • awesome man. thank you

                – BasILyoS
                Sep 20 '13 at 11:22











              • you welcome....

                – Mukesh Kumar Singh
                Sep 20 '13 at 11:23











              • Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

                – Zordid
                Mar 16 '14 at 19:41






              • 8





                While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

                – rlazo
                Jun 18 '15 at 18:35








              • 7





                android:layoutDirection="rtl" ..... it is more easier :P

                – Muhammad Adil
                Jun 24 '16 at 18:49

















              awesome man. thank you

              – BasILyoS
              Sep 20 '13 at 11:22





              awesome man. thank you

              – BasILyoS
              Sep 20 '13 at 11:22













              you welcome....

              – Mukesh Kumar Singh
              Sep 20 '13 at 11:23





              you welcome....

              – Mukesh Kumar Singh
              Sep 20 '13 at 11:23













              Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

              – Zordid
              Mar 16 '14 at 19:41





              Well, this kindof works... but it gives a different radio button image. On Holo you get another image in the original RadioButton... :(

              – Zordid
              Mar 16 '14 at 19:41




              8




              8





              While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

              – rlazo
              Jun 18 '15 at 18:35







              While the solution works, the first sentence is misleading. The radio buttons are moved to the right of the text, instead of to the left, because of android:button="@null" and android:drawableRight="@android:drawable/btn_radio". What android:gravity="right" does is aligning the widget to the right of its parent, rather than just the button.

              – rlazo
              Jun 18 '15 at 18:35






              7




              7





              android:layoutDirection="rtl" ..... it is more easier :P

              – Muhammad Adil
              Jun 24 '16 at 18:49





              android:layoutDirection="rtl" ..... it is more easier :P

              – Muhammad Adil
              Jun 24 '16 at 18:49













              83














              Try adding the following attributes into the RadioButton, it should work, this way you still get to keep the ripple effect on the radio button:



                          android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"


              Remember to set supportsRtl property to true in your application manifest.



              for eg:



                         <RadioGroup
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" >

              <RadioButton
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="4dp"
              android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"
              android:text="The test item a"
              android:textSize="14sp" />

              ....

              </RadioGroup>


              would give out:



              enter image description here






              share|improve this answer





















              • 4





                Give this man a medal! Finally a solution that works. Thx

                – Francois Dermu
                Sep 27 '16 at 19:23






              • 1





                this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

                – jboxxpradhana
                Oct 4 '16 at 13:42











              • android:layoutDirection="rtl" this worked

                – Syed Raza Mehdi
                Dec 28 '16 at 9:48











              • you should use appcompat radiobutton to bypass sdk level limitation

                – user2729200
                Jun 16 '17 at 7:23











              • Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

                – user1202032
                Feb 13 '18 at 8:50
















              83














              Try adding the following attributes into the RadioButton, it should work, this way you still get to keep the ripple effect on the radio button:



                          android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"


              Remember to set supportsRtl property to true in your application manifest.



              for eg:



                         <RadioGroup
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" >

              <RadioButton
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="4dp"
              android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"
              android:text="The test item a"
              android:textSize="14sp" />

              ....

              </RadioGroup>


              would give out:



              enter image description here






              share|improve this answer





















              • 4





                Give this man a medal! Finally a solution that works. Thx

                – Francois Dermu
                Sep 27 '16 at 19:23






              • 1





                this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

                – jboxxpradhana
                Oct 4 '16 at 13:42











              • android:layoutDirection="rtl" this worked

                – Syed Raza Mehdi
                Dec 28 '16 at 9:48











              • you should use appcompat radiobutton to bypass sdk level limitation

                – user2729200
                Jun 16 '17 at 7:23











              • Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

                – user1202032
                Feb 13 '18 at 8:50














              83












              83








              83







              Try adding the following attributes into the RadioButton, it should work, this way you still get to keep the ripple effect on the radio button:



                          android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"


              Remember to set supportsRtl property to true in your application manifest.



              for eg:



                         <RadioGroup
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" >

              <RadioButton
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="4dp"
              android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"
              android:text="The test item a"
              android:textSize="14sp" />

              ....

              </RadioGroup>


              would give out:



              enter image description here






              share|improve this answer















              Try adding the following attributes into the RadioButton, it should work, this way you still get to keep the ripple effect on the radio button:



                          android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"


              Remember to set supportsRtl property to true in your application manifest.



              for eg:



                         <RadioGroup
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" >

              <RadioButton
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="4dp"
              android:layoutDirection="rtl"
              android:textAlignment="textStart"
              android:layout_gravity="start"
              android:text="The test item a"
              android:textSize="14sp" />

              ....

              </RadioGroup>


              would give out:



              enter image description here







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 27 '16 at 9:48









              lukaspp

              11419




              11419










              answered Jul 31 '16 at 6:01









              IrshuIrshu

              3,90353453




              3,90353453








              • 4





                Give this man a medal! Finally a solution that works. Thx

                – Francois Dermu
                Sep 27 '16 at 19:23






              • 1





                this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

                – jboxxpradhana
                Oct 4 '16 at 13:42











              • android:layoutDirection="rtl" this worked

                – Syed Raza Mehdi
                Dec 28 '16 at 9:48











              • you should use appcompat radiobutton to bypass sdk level limitation

                – user2729200
                Jun 16 '17 at 7:23











              • Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

                – user1202032
                Feb 13 '18 at 8:50














              • 4





                Give this man a medal! Finally a solution that works. Thx

                – Francois Dermu
                Sep 27 '16 at 19:23






              • 1





                this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

                – jboxxpradhana
                Oct 4 '16 at 13:42











              • android:layoutDirection="rtl" this worked

                – Syed Raza Mehdi
                Dec 28 '16 at 9:48











              • you should use appcompat radiobutton to bypass sdk level limitation

                – user2729200
                Jun 16 '17 at 7:23











              • Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

                – user1202032
                Feb 13 '18 at 8:50








              4




              4





              Give this man a medal! Finally a solution that works. Thx

              – Francois Dermu
              Sep 27 '16 at 19:23





              Give this man a medal! Finally a solution that works. Thx

              – Francois Dermu
              Sep 27 '16 at 19:23




              1




              1





              this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

              – jboxxpradhana
              Oct 4 '16 at 13:42





              this method need minimum sdk level 17 how can I make view like that if I have the minimum sdk level < 17

              – jboxxpradhana
              Oct 4 '16 at 13:42













              android:layoutDirection="rtl" this worked

              – Syed Raza Mehdi
              Dec 28 '16 at 9:48





              android:layoutDirection="rtl" this worked

              – Syed Raza Mehdi
              Dec 28 '16 at 9:48













              you should use appcompat radiobutton to bypass sdk level limitation

              – user2729200
              Jun 16 '17 at 7:23





              you should use appcompat radiobutton to bypass sdk level limitation

              – user2729200
              Jun 16 '17 at 7:23













              Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

              – user1202032
              Feb 13 '18 at 8:50





              Im not sure if this used to work, it seems like it, but for me it does not produce the result in the screenshot - not even close

              – user1202032
              Feb 13 '18 at 8:50











              19














              There is property called android:drawableRight which will set your drawable right side of your text and set android:button as null. check below piece of code:



              Note: This is sample, you can apply to your all radioButton.



               <RadioButton 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:button="@null"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="Left"/>





              share|improve this answer
























              • but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

                – Shirish Herwade
                Jan 20 '15 at 18:50
















              19














              There is property called android:drawableRight which will set your drawable right side of your text and set android:button as null. check below piece of code:



              Note: This is sample, you can apply to your all radioButton.



               <RadioButton 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:button="@null"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="Left"/>





              share|improve this answer
























              • but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

                – Shirish Herwade
                Jan 20 '15 at 18:50














              19












              19








              19







              There is property called android:drawableRight which will set your drawable right side of your text and set android:button as null. check below piece of code:



              Note: This is sample, you can apply to your all radioButton.



               <RadioButton 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:button="@null"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="Left"/>





              share|improve this answer













              There is property called android:drawableRight which will set your drawable right side of your text and set android:button as null. check below piece of code:



              Note: This is sample, you can apply to your all radioButton.



               <RadioButton 
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:button="@null"
              android:drawableRight="@android:drawable/btn_radio"
              android:text="Left"/>






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 20 '13 at 11:23









              RobinHoodRobinHood

              8,89243586




              8,89243586













              • but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

                – Shirish Herwade
                Jan 20 '15 at 18:50



















              • but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

                – Shirish Herwade
                Jan 20 '15 at 18:50

















              but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

              – Shirish Herwade
              Jan 20 '15 at 18:50





              but after this, the radio button is not getting checked(clicked). Im i doing something wrong. please help stackoverflow.com/questions/28052820/…

              – Shirish Herwade
              Jan 20 '15 at 18:50











              10














              Just add:



              android:button="@null"
              android:drawableRight="@android:drawable/btn_radio"





              share|improve this answer




























                10














                Just add:



                android:button="@null"
                android:drawableRight="@android:drawable/btn_radio"





                share|improve this answer


























                  10












                  10








                  10







                  Just add:



                  android:button="@null"
                  android:drawableRight="@android:drawable/btn_radio"





                  share|improve this answer













                  Just add:



                  android:button="@null"
                  android:drawableRight="@android:drawable/btn_radio"






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 17 '16 at 8:35









                  SeyyedSeyyed

                  68721123




                  68721123























                      9














                      Based on the answer of Irshu I suggest the following solution which uses the material ripple effect and produces the following outcome:



                      Demo



                      If you want the dividers as shown in the GIF than simply add a view with the height of 1 and a background color between the radiobuttons.



                      <RadioGroup
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:checkedButton="@+id/radioButton1">

                      <RadioButton
                      android:id="@+id/radioButton1"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button1"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button2"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton3"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button3"
                      android:textSize="14sp" />
                      </RadioGroup>





                      share|improve this answer


























                      • Thank you really much!

                        – Gabriella Angelova
                        Dec 5 '18 at 12:26
















                      9














                      Based on the answer of Irshu I suggest the following solution which uses the material ripple effect and produces the following outcome:



                      Demo



                      If you want the dividers as shown in the GIF than simply add a view with the height of 1 and a background color between the radiobuttons.



                      <RadioGroup
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:checkedButton="@+id/radioButton1">

                      <RadioButton
                      android:id="@+id/radioButton1"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button1"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button2"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton3"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button3"
                      android:textSize="14sp" />
                      </RadioGroup>





                      share|improve this answer


























                      • Thank you really much!

                        – Gabriella Angelova
                        Dec 5 '18 at 12:26














                      9












                      9








                      9







                      Based on the answer of Irshu I suggest the following solution which uses the material ripple effect and produces the following outcome:



                      Demo



                      If you want the dividers as shown in the GIF than simply add a view with the height of 1 and a background color between the radiobuttons.



                      <RadioGroup
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:checkedButton="@+id/radioButton1">

                      <RadioButton
                      android:id="@+id/radioButton1"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button1"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button2"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton3"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button3"
                      android:textSize="14sp" />
                      </RadioGroup>





                      share|improve this answer















                      Based on the answer of Irshu I suggest the following solution which uses the material ripple effect and produces the following outcome:



                      Demo



                      If you want the dividers as shown in the GIF than simply add a view with the height of 1 and a background color between the radiobuttons.



                      <RadioGroup
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:checkedButton="@+id/radioButton1">

                      <RadioButton
                      android:id="@+id/radioButton1"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button1"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button2"
                      android:textSize="14sp" />

                      <RadioButton
                      android:id="@+id/radioButton3"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:button="@null"
                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"
                      android:background="?android:selectableItemBackground"
                      android:layoutDirection="rtl"
                      android:layout_gravity="start"
                      android:textAlignment="textStart"
                      android:paddingBottom="10dp"
                      android:paddingLeft="20dp"
                      android:paddingRight="20dp"
                      android:paddingTop="10dp"
                      android:text="Button3"
                      android:textSize="14sp" />
                      </RadioGroup>






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 21 '18 at 13:38

























                      answered Jun 21 '18 at 13:30









                      MaxMax

                      285310




                      285310













                      • Thank you really much!

                        – Gabriella Angelova
                        Dec 5 '18 at 12:26



















                      • Thank you really much!

                        – Gabriella Angelova
                        Dec 5 '18 at 12:26

















                      Thank you really much!

                      – Gabriella Angelova
                      Dec 5 '18 at 12:26





                      Thank you really much!

                      – Gabriella Angelova
                      Dec 5 '18 at 12:26











                      7














                      add this in xml : ( 4.2 and above)



                      android:layoutDirection="rtl"


                      for older version than 4.2 use ViewCompat from android.support.v4.view:



                      ViewCompat.setLayoutDirection(findViewById(R.id.radio_button), ViewCompat.LAYOUT_DIRECTION_RTL);





                      share|improve this answer






























                        7














                        add this in xml : ( 4.2 and above)



                        android:layoutDirection="rtl"


                        for older version than 4.2 use ViewCompat from android.support.v4.view:



                        ViewCompat.setLayoutDirection(findViewById(R.id.radio_button), ViewCompat.LAYOUT_DIRECTION_RTL);





                        share|improve this answer




























                          7












                          7








                          7







                          add this in xml : ( 4.2 and above)



                          android:layoutDirection="rtl"


                          for older version than 4.2 use ViewCompat from android.support.v4.view:



                          ViewCompat.setLayoutDirection(findViewById(R.id.radio_button), ViewCompat.LAYOUT_DIRECTION_RTL);





                          share|improve this answer















                          add this in xml : ( 4.2 and above)



                          android:layoutDirection="rtl"


                          for older version than 4.2 use ViewCompat from android.support.v4.view:



                          ViewCompat.setLayoutDirection(findViewById(R.id.radio_button), ViewCompat.LAYOUT_DIRECTION_RTL);






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jul 14 '17 at 11:06

























                          answered Jul 14 '17 at 10:40









                          masood farmanimasood farmani

                          8114




                          8114























                              3














                              In case anyone is still wondering how to achieve this, here's a better solution in my opinion:
                              RadioGroup class extends LineareLayout. You can add a simple radio button and a TextView beside it and easily have the same effect:



                              <RadioGroup
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"
                              android:gravity="center_horizontal"
                              android:orientation="horizontal">

                              <TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:text="خانم"/>

                              <RadioButton
                              android:id="@+id/female"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginRight="20dp"
                              />

                              <TextView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginLeft="20dp"
                              android:text="آقا"/>

                              <RadioButton
                              android:id="@+id/male"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              />

                              </RadioGroup>


                              Which then makes a layout like below:



                              enter image description here






                              share|improve this answer




























                                3














                                In case anyone is still wondering how to achieve this, here's a better solution in my opinion:
                                RadioGroup class extends LineareLayout. You can add a simple radio button and a TextView beside it and easily have the same effect:



                                <RadioGroup
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:gravity="center_horizontal"
                                android:orientation="horizontal">

                                <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="خانم"/>

                                <RadioButton
                                android:id="@+id/female"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginRight="20dp"
                                />

                                <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="20dp"
                                android:text="آقا"/>

                                <RadioButton
                                android:id="@+id/male"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                />

                                </RadioGroup>


                                Which then makes a layout like below:



                                enter image description here






                                share|improve this answer


























                                  3












                                  3








                                  3







                                  In case anyone is still wondering how to achieve this, here's a better solution in my opinion:
                                  RadioGroup class extends LineareLayout. You can add a simple radio button and a TextView beside it and easily have the same effect:



                                  <RadioGroup
                                  android:layout_width="match_parent"
                                  android:layout_height="match_parent"
                                  android:gravity="center_horizontal"
                                  android:orientation="horizontal">

                                  <TextView
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:text="خانم"/>

                                  <RadioButton
                                  android:id="@+id/female"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginRight="20dp"
                                  />

                                  <TextView
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginLeft="20dp"
                                  android:text="آقا"/>

                                  <RadioButton
                                  android:id="@+id/male"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  />

                                  </RadioGroup>


                                  Which then makes a layout like below:



                                  enter image description here






                                  share|improve this answer













                                  In case anyone is still wondering how to achieve this, here's a better solution in my opinion:
                                  RadioGroup class extends LineareLayout. You can add a simple radio button and a TextView beside it and easily have the same effect:



                                  <RadioGroup
                                  android:layout_width="match_parent"
                                  android:layout_height="match_parent"
                                  android:gravity="center_horizontal"
                                  android:orientation="horizontal">

                                  <TextView
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:text="خانم"/>

                                  <RadioButton
                                  android:id="@+id/female"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginRight="20dp"
                                  />

                                  <TextView
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginLeft="20dp"
                                  android:text="آقا"/>

                                  <RadioButton
                                  android:id="@+id/male"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  />

                                  </RadioGroup>


                                  Which then makes a layout like below:



                                  enter image description here







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Mar 5 '17 at 6:45









                                  Saeed EntezariSaeed Entezari

                                  1,198718




                                  1,198718























                                      3














                                      Very simple, you want the text to appear in the left of the radio button, you just have to change the layout direction to rtl (== right to left):



                                      android:layoutDirection="rtl"





                                      share|improve this answer






























                                        3














                                        Very simple, you want the text to appear in the left of the radio button, you just have to change the layout direction to rtl (== right to left):



                                        android:layoutDirection="rtl"





                                        share|improve this answer




























                                          3












                                          3








                                          3







                                          Very simple, you want the text to appear in the left of the radio button, you just have to change the layout direction to rtl (== right to left):



                                          android:layoutDirection="rtl"





                                          share|improve this answer















                                          Very simple, you want the text to appear in the left of the radio button, you just have to change the layout direction to rtl (== right to left):



                                          android:layoutDirection="rtl"






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited Dec 31 '18 at 16:06









                                          Nino Filiu

                                          1,55511021




                                          1,55511021










                                          answered Dec 31 '18 at 13:52









                                          medmahmoudkeddamedmahmoudkedda

                                          311




                                          311























                                              2














                                              I've used a trick like the code below to achieve this in all SDKs with default UI and default select behavior:



                                              <LinearLayout
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content"
                                              android:layoutDirection="ltr"
                                              android:orientation="vertical"
                                              android:padding="10dp">

                                              <RelativeLayout
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content">

                                              <TextView
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content"
                                              android:layout_centerVertical="true"
                                              android:layout_marginRight="30dp"
                                              android:paddingLeft="15dp"
                                              android:paddingRight="15dp"
                                              android:text="RadioButton 1"
                                              android:textColor="@color/Black" />

                                              <RadioButton
                                              android:id="@+id/rb1"
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content"
                                              android:layout_alignParentRight="true"
                                              android:paddingBottom="10dp"
                                              android:paddingTop="10dp"
                                              android:scaleX="-1" />
                                              </RelativeLayout>

                                              <RelativeLayout
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content">

                                              <TextView
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content"
                                              android:layout_centerVertical="true"
                                              android:layout_marginRight="30dp"
                                              android:paddingLeft="15dp"
                                              android:paddingRight="15dp"
                                              android:text="RadioButton 2"
                                              android:textColor="@color/Black" />

                                              <RadioButton
                                              android:id="@+id/rb2"
                                              android:layout_width="match_parent"
                                              android:layout_height="wrap_content"
                                              android:layout_alignParentRight="true"
                                              android:paddingBottom="10dp"
                                              android:paddingTop="10dp"
                                              android:scaleX="-1" />
                                              </RelativeLayout>
                                              </LinearLayout>


                                              Now for make the buttons single selectable, just write the code for buttons onCheckedChanged listener and make other buttons unchecked.



                                              Like this:



                                              rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                                              @Override
                                              public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                                              if(checked)
                                              rb2.setChecked(false);
                                              }
                                              });





                                              share|improve this answer




























                                                2














                                                I've used a trick like the code below to achieve this in all SDKs with default UI and default select behavior:



                                                <LinearLayout
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layoutDirection="ltr"
                                                android:orientation="vertical"
                                                android:padding="10dp">

                                                <RelativeLayout
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content">

                                                <TextView
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layout_centerVertical="true"
                                                android:layout_marginRight="30dp"
                                                android:paddingLeft="15dp"
                                                android:paddingRight="15dp"
                                                android:text="RadioButton 1"
                                                android:textColor="@color/Black" />

                                                <RadioButton
                                                android:id="@+id/rb1"
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layout_alignParentRight="true"
                                                android:paddingBottom="10dp"
                                                android:paddingTop="10dp"
                                                android:scaleX="-1" />
                                                </RelativeLayout>

                                                <RelativeLayout
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content">

                                                <TextView
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layout_centerVertical="true"
                                                android:layout_marginRight="30dp"
                                                android:paddingLeft="15dp"
                                                android:paddingRight="15dp"
                                                android:text="RadioButton 2"
                                                android:textColor="@color/Black" />

                                                <RadioButton
                                                android:id="@+id/rb2"
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layout_alignParentRight="true"
                                                android:paddingBottom="10dp"
                                                android:paddingTop="10dp"
                                                android:scaleX="-1" />
                                                </RelativeLayout>
                                                </LinearLayout>


                                                Now for make the buttons single selectable, just write the code for buttons onCheckedChanged listener and make other buttons unchecked.



                                                Like this:



                                                rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                                                @Override
                                                public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                                                if(checked)
                                                rb2.setChecked(false);
                                                }
                                                });





                                                share|improve this answer


























                                                  2












                                                  2








                                                  2







                                                  I've used a trick like the code below to achieve this in all SDKs with default UI and default select behavior:



                                                  <LinearLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layoutDirection="ltr"
                                                  android:orientation="vertical"
                                                  android:padding="10dp">

                                                  <RelativeLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content">

                                                  <TextView
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_centerVertical="true"
                                                  android:layout_marginRight="30dp"
                                                  android:paddingLeft="15dp"
                                                  android:paddingRight="15dp"
                                                  android:text="RadioButton 1"
                                                  android:textColor="@color/Black" />

                                                  <RadioButton
                                                  android:id="@+id/rb1"
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_alignParentRight="true"
                                                  android:paddingBottom="10dp"
                                                  android:paddingTop="10dp"
                                                  android:scaleX="-1" />
                                                  </RelativeLayout>

                                                  <RelativeLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content">

                                                  <TextView
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_centerVertical="true"
                                                  android:layout_marginRight="30dp"
                                                  android:paddingLeft="15dp"
                                                  android:paddingRight="15dp"
                                                  android:text="RadioButton 2"
                                                  android:textColor="@color/Black" />

                                                  <RadioButton
                                                  android:id="@+id/rb2"
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_alignParentRight="true"
                                                  android:paddingBottom="10dp"
                                                  android:paddingTop="10dp"
                                                  android:scaleX="-1" />
                                                  </RelativeLayout>
                                                  </LinearLayout>


                                                  Now for make the buttons single selectable, just write the code for buttons onCheckedChanged listener and make other buttons unchecked.



                                                  Like this:



                                                  rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                                                  @Override
                                                  public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                                                  if(checked)
                                                  rb2.setChecked(false);
                                                  }
                                                  });





                                                  share|improve this answer













                                                  I've used a trick like the code below to achieve this in all SDKs with default UI and default select behavior:



                                                  <LinearLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layoutDirection="ltr"
                                                  android:orientation="vertical"
                                                  android:padding="10dp">

                                                  <RelativeLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content">

                                                  <TextView
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_centerVertical="true"
                                                  android:layout_marginRight="30dp"
                                                  android:paddingLeft="15dp"
                                                  android:paddingRight="15dp"
                                                  android:text="RadioButton 1"
                                                  android:textColor="@color/Black" />

                                                  <RadioButton
                                                  android:id="@+id/rb1"
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_alignParentRight="true"
                                                  android:paddingBottom="10dp"
                                                  android:paddingTop="10dp"
                                                  android:scaleX="-1" />
                                                  </RelativeLayout>

                                                  <RelativeLayout
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content">

                                                  <TextView
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_centerVertical="true"
                                                  android:layout_marginRight="30dp"
                                                  android:paddingLeft="15dp"
                                                  android:paddingRight="15dp"
                                                  android:text="RadioButton 2"
                                                  android:textColor="@color/Black" />

                                                  <RadioButton
                                                  android:id="@+id/rb2"
                                                  android:layout_width="match_parent"
                                                  android:layout_height="wrap_content"
                                                  android:layout_alignParentRight="true"
                                                  android:paddingBottom="10dp"
                                                  android:paddingTop="10dp"
                                                  android:scaleX="-1" />
                                                  </RelativeLayout>
                                                  </LinearLayout>


                                                  Now for make the buttons single selectable, just write the code for buttons onCheckedChanged listener and make other buttons unchecked.



                                                  Like this:



                                                  rb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                                                  @Override
                                                  public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                                                  if(checked)
                                                  rb2.setChecked(false);
                                                  }
                                                  });






                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Mar 11 '17 at 11:41









                                                  SiSaSiSa

                                                  8921720




                                                  8921720























                                                      2














                                                      try this code :



                                                                           <RadioGroup
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:orientation="vertical"
                                                      android:gravity="right">

                                                      <RadioButton
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:textDirection="rtl"
                                                      android:layout_margin="4dp"
                                                      android:layoutDirection="rtl"
                                                      android:textAlignment="textStart"
                                                      android:layout_gravity="start"
                                                      android:text="اول"
                                                      android:textSize="15dp"/>
                                                      </RadioGroup>


                                                      result :
                                                      show result






                                                      share|improve this answer





















                                                      • 2





                                                        Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                        – B001ᛦ
                                                        Jun 13 '18 at 10:23
















                                                      2














                                                      try this code :



                                                                           <RadioGroup
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:orientation="vertical"
                                                      android:gravity="right">

                                                      <RadioButton
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:textDirection="rtl"
                                                      android:layout_margin="4dp"
                                                      android:layoutDirection="rtl"
                                                      android:textAlignment="textStart"
                                                      android:layout_gravity="start"
                                                      android:text="اول"
                                                      android:textSize="15dp"/>
                                                      </RadioGroup>


                                                      result :
                                                      show result






                                                      share|improve this answer





















                                                      • 2





                                                        Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                        – B001ᛦ
                                                        Jun 13 '18 at 10:23














                                                      2












                                                      2








                                                      2







                                                      try this code :



                                                                           <RadioGroup
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:orientation="vertical"
                                                      android:gravity="right">

                                                      <RadioButton
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:textDirection="rtl"
                                                      android:layout_margin="4dp"
                                                      android:layoutDirection="rtl"
                                                      android:textAlignment="textStart"
                                                      android:layout_gravity="start"
                                                      android:text="اول"
                                                      android:textSize="15dp"/>
                                                      </RadioGroup>


                                                      result :
                                                      show result






                                                      share|improve this answer















                                                      try this code :



                                                                           <RadioGroup
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:orientation="vertical"
                                                      android:gravity="right">

                                                      <RadioButton
                                                      android:layout_width="match_parent"
                                                      android:layout_height="wrap_content"
                                                      android:textDirection="rtl"
                                                      android:layout_margin="4dp"
                                                      android:layoutDirection="rtl"
                                                      android:textAlignment="textStart"
                                                      android:layout_gravity="start"
                                                      android:text="اول"
                                                      android:textSize="15dp"/>
                                                      </RadioGroup>


                                                      result :
                                                      show result







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Sep 3 '18 at 16:36

























                                                      answered Jun 13 '18 at 10:15









                                                      ali shahriarimaneshali shahriarimanesh

                                                      212




                                                      212








                                                      • 2





                                                        Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                        – B001ᛦ
                                                        Jun 13 '18 at 10:23














                                                      • 2





                                                        Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                        – B001ᛦ
                                                        Jun 13 '18 at 10:23








                                                      2




                                                      2





                                                      Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                      – B001ᛦ
                                                      Jun 13 '18 at 10:23





                                                      Why should the OP "try this code"? A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO.

                                                      – B001ᛦ
                                                      Jun 13 '18 at 10:23











                                                      1














                                                      try this code and change the values to your arabic words..



                                                      main.xml



                                                      <?xml version="1.0" encoding="utf-8"?>
                                                      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                      android:orientation="vertical"
                                                      android:layout_width="fill_parent"
                                                      android:layout_height="fill_parent"
                                                      >
                                                      <RadioGroup
                                                      android:id="@+id/radioGender"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content" >

                                                      <RadioButton
                                                      android:id="@+id/radioMale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_male"
                                                      android:checked="true" />

                                                      <RadioButton
                                                      android:id="@+id/radioFemale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_female" />

                                                      </RadioGroup>

                                                      <Button
                                                      android:id="@+id/btnDisplay"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/btn_display" />

                                                      </LinearLayout>





                                                      share|improve this answer



















                                                      • 1





                                                        oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                        – BasILyoS
                                                        Sep 20 '13 at 11:12
















                                                      1














                                                      try this code and change the values to your arabic words..



                                                      main.xml



                                                      <?xml version="1.0" encoding="utf-8"?>
                                                      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                      android:orientation="vertical"
                                                      android:layout_width="fill_parent"
                                                      android:layout_height="fill_parent"
                                                      >
                                                      <RadioGroup
                                                      android:id="@+id/radioGender"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content" >

                                                      <RadioButton
                                                      android:id="@+id/radioMale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_male"
                                                      android:checked="true" />

                                                      <RadioButton
                                                      android:id="@+id/radioFemale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_female" />

                                                      </RadioGroup>

                                                      <Button
                                                      android:id="@+id/btnDisplay"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/btn_display" />

                                                      </LinearLayout>





                                                      share|improve this answer



















                                                      • 1





                                                        oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                        – BasILyoS
                                                        Sep 20 '13 at 11:12














                                                      1












                                                      1








                                                      1







                                                      try this code and change the values to your arabic words..



                                                      main.xml



                                                      <?xml version="1.0" encoding="utf-8"?>
                                                      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                      android:orientation="vertical"
                                                      android:layout_width="fill_parent"
                                                      android:layout_height="fill_parent"
                                                      >
                                                      <RadioGroup
                                                      android:id="@+id/radioGender"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content" >

                                                      <RadioButton
                                                      android:id="@+id/radioMale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_male"
                                                      android:checked="true" />

                                                      <RadioButton
                                                      android:id="@+id/radioFemale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_female" />

                                                      </RadioGroup>

                                                      <Button
                                                      android:id="@+id/btnDisplay"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/btn_display" />

                                                      </LinearLayout>





                                                      share|improve this answer













                                                      try this code and change the values to your arabic words..



                                                      main.xml



                                                      <?xml version="1.0" encoding="utf-8"?>
                                                      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                      android:orientation="vertical"
                                                      android:layout_width="fill_parent"
                                                      android:layout_height="fill_parent"
                                                      >
                                                      <RadioGroup
                                                      android:id="@+id/radioGender"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content" >

                                                      <RadioButton
                                                      android:id="@+id/radioMale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_male"
                                                      android:checked="true" />

                                                      <RadioButton
                                                      android:id="@+id/radioFemale"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/radio_female" />

                                                      </RadioGroup>

                                                      <Button
                                                      android:id="@+id/btnDisplay"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:text="@string/btn_display" />

                                                      </LinearLayout>






                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered Sep 20 '13 at 11:05







                                                      user2790339















                                                      • 1





                                                        oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                        – BasILyoS
                                                        Sep 20 '13 at 11:12














                                                      • 1





                                                        oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                        – BasILyoS
                                                        Sep 20 '13 at 11:12








                                                      1




                                                      1





                                                      oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                      – BasILyoS
                                                      Sep 20 '13 at 11:12





                                                      oh man, what is this code it's the default radio button. what I want is to have the radio button like the picture above radio button on the right of the text and the text should be aligned to the right

                                                      – BasILyoS
                                                      Sep 20 '13 at 11:12











                                                      1














                                                      Take a look at the "CustomChoiceList" example, there it is explained how you can create either your own check boxes/radio buttons or how you can create a ListView with the default check boxes/radio buttons used in the android settings, for example. You should especially note the res/layout/sample_main.xml file, it expains much.






                                                      share|improve this answer



















                                                      • 3





                                                        Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                        – Sean Connolly
                                                        Jan 19 '14 at 20:40
















                                                      1














                                                      Take a look at the "CustomChoiceList" example, there it is explained how you can create either your own check boxes/radio buttons or how you can create a ListView with the default check boxes/radio buttons used in the android settings, for example. You should especially note the res/layout/sample_main.xml file, it expains much.






                                                      share|improve this answer



















                                                      • 3





                                                        Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                        – Sean Connolly
                                                        Jan 19 '14 at 20:40














                                                      1












                                                      1








                                                      1







                                                      Take a look at the "CustomChoiceList" example, there it is explained how you can create either your own check boxes/radio buttons or how you can create a ListView with the default check boxes/radio buttons used in the android settings, for example. You should especially note the res/layout/sample_main.xml file, it expains much.






                                                      share|improve this answer













                                                      Take a look at the "CustomChoiceList" example, there it is explained how you can create either your own check boxes/radio buttons or how you can create a ListView with the default check boxes/radio buttons used in the android settings, for example. You should especially note the res/layout/sample_main.xml file, it expains much.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered Jan 19 '14 at 20:20









                                                      Daniel HöhDaniel Höh

                                                      112




                                                      112








                                                      • 3





                                                        Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                        – Sean Connolly
                                                        Jan 19 '14 at 20:40














                                                      • 3





                                                        Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                        – Sean Connolly
                                                        Jan 19 '14 at 20:40








                                                      3




                                                      3





                                                      Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                      – Sean Connolly
                                                      Jan 19 '14 at 20:40





                                                      Please provide the relevant code or explanation as part of your answer rather than linking to another resource.

                                                      – Sean Connolly
                                                      Jan 19 '14 at 20:40











                                                      1














                                                                  android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      fontPath="@string/font_nunito_light"
                                                      android:text="Male"
                                                      android:layout_marginTop="@dimen/dp_10"
                                                      android:drawablePadding="@dimen/dp_10"
                                                      android:drawableStart="@drawable/selector_radio"
                                                      android:button="@null"
                                                      android:id="@+id/rb_"
                                                      android:checked="true"
                                                      android:textSize="@dimen/sp_15"





                                                      share|improve this answer



















                                                      • 3





                                                        While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                        – blue-phoenox
                                                        May 17 '18 at 9:39
















                                                      1














                                                                  android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      fontPath="@string/font_nunito_light"
                                                      android:text="Male"
                                                      android:layout_marginTop="@dimen/dp_10"
                                                      android:drawablePadding="@dimen/dp_10"
                                                      android:drawableStart="@drawable/selector_radio"
                                                      android:button="@null"
                                                      android:id="@+id/rb_"
                                                      android:checked="true"
                                                      android:textSize="@dimen/sp_15"





                                                      share|improve this answer



















                                                      • 3





                                                        While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                        – blue-phoenox
                                                        May 17 '18 at 9:39














                                                      1












                                                      1








                                                      1







                                                                  android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      fontPath="@string/font_nunito_light"
                                                      android:text="Male"
                                                      android:layout_marginTop="@dimen/dp_10"
                                                      android:drawablePadding="@dimen/dp_10"
                                                      android:drawableStart="@drawable/selector_radio"
                                                      android:button="@null"
                                                      android:id="@+id/rb_"
                                                      android:checked="true"
                                                      android:textSize="@dimen/sp_15"





                                                      share|improve this answer













                                                                  android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      fontPath="@string/font_nunito_light"
                                                      android:text="Male"
                                                      android:layout_marginTop="@dimen/dp_10"
                                                      android:drawablePadding="@dimen/dp_10"
                                                      android:drawableStart="@drawable/selector_radio"
                                                      android:button="@null"
                                                      android:id="@+id/rb_"
                                                      android:checked="true"
                                                      android:textSize="@dimen/sp_15"






                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered May 17 '18 at 9:21









                                                      Dishant KawatraDishant Kawatra

                                                      664




                                                      664








                                                      • 3





                                                        While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                        – blue-phoenox
                                                        May 17 '18 at 9:39














                                                      • 3





                                                        While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                        – blue-phoenox
                                                        May 17 '18 at 9:39








                                                      3




                                                      3





                                                      While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                      – blue-phoenox
                                                      May 17 '18 at 9:39





                                                      While this code might answer the question you still might consider adding a few explanatory sentences as this increases the value of your answer for other users.

                                                      – blue-phoenox
                                                      May 17 '18 at 9:39











                                                      0














                                                      to keep material style use android:drawableRight="?android:attr/listChoiceIndicatorSingle"



                                                      <RadioButton
                                                      android:id="@+id/radioButton"
                                                      android:layout_width="wrap_content"
                                                      android:layout_height="wrap_content"
                                                      android:button="@null"
                                                      android:text="rtl button"
                                                      android:drawableRight="?android:attr/listChoiceIndicatorSingle"/>





                                                      share|improve this answer




























                                                        0














                                                        to keep material style use android:drawableRight="?android:attr/listChoiceIndicatorSingle"



                                                        <RadioButton
                                                        android:id="@+id/radioButton"
                                                        android:layout_width="wrap_content"
                                                        android:layout_height="wrap_content"
                                                        android:button="@null"
                                                        android:text="rtl button"
                                                        android:drawableRight="?android:attr/listChoiceIndicatorSingle"/>





                                                        share|improve this answer


























                                                          0












                                                          0








                                                          0







                                                          to keep material style use android:drawableRight="?android:attr/listChoiceIndicatorSingle"



                                                          <RadioButton
                                                          android:id="@+id/radioButton"
                                                          android:layout_width="wrap_content"
                                                          android:layout_height="wrap_content"
                                                          android:button="@null"
                                                          android:text="rtl button"
                                                          android:drawableRight="?android:attr/listChoiceIndicatorSingle"/>





                                                          share|improve this answer













                                                          to keep material style use android:drawableRight="?android:attr/listChoiceIndicatorSingle"



                                                          <RadioButton
                                                          android:id="@+id/radioButton"
                                                          android:layout_width="wrap_content"
                                                          android:layout_height="wrap_content"
                                                          android:button="@null"
                                                          android:text="rtl button"
                                                          android:drawableRight="?android:attr/listChoiceIndicatorSingle"/>






                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered Jan 27 at 6:29









                                                          Milad Mohammad RezaeiMilad Mohammad Rezaei

                                                          412




                                                          412






























                                                              draft saved

                                                              draft discarded




















































                                                              Thanks for contributing an answer to Stack Overflow!


                                                              • Please be sure to answer the question. Provide details and share your research!

                                                              But avoid



                                                              • Asking for help, clarification, or responding to other answers.

                                                              • Making statements based on opinion; back them up with references or personal experience.


                                                              To learn more, see our tips on writing great answers.




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function () {
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18914792%2fhow-to-put-the-text-on-the-left-of-a-radio-button-in-android%23new-answer', 'question_page');
                                                              }
                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Monofisismo

                                                              Angular Downloading a file using contenturl with Basic Authentication

                                                              Olmecas