How to align switch in android

Hi

I am trying to use the following example when using a radio group / radio button in an Android app. http://www.androidpeople.com/android-radiobutton-example/

But the switch is on the left side of the label (text).

Could you tell me how I can configure it so that the switch is on the right side of the shortcut? and the text is left aligned with the parent, and the radio button is aligned with the right of the parent?

Thank.

+3
source share
2 answers

Radio button for right alignment:

<RadioButton
                    android:id="@+id/radio0"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:background="@null"
                    android:button="@null"
                    android:checked="true"
                    android:drawableRight="@drawable/presets_sel"
                    android:padding="12dp"
                    android:text="RadioButton 1" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/right_arrow_h" android:state_checked="true"/>
    <item android:drawable="@drawable/right_arrow_h" android:state_pressed="true"/>
    <item android:drawable="@drawable/right_arrow"></item>

</selector>
+3
source

. , , RadioButtons!

!

0

Source: https://habr.com/ru/post/1756398/


All Articles