Android vertically align text and widget - android

I'm using a text label and a radio group in a horizontal linear layout:
How do I set it so that the label (Sex) appears in the vertical center of the radio group? Currently it appears too high
The code for this portion of my layout is:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:text="Sex:" />
<RadioGroup
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:id="#+id/input_button_male"
android:paddingRight="10dp"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:id="#+id/input_button_female"
android:paddingRight="10dp"/>
</RadioGroup>
</LinearLayout>

I think you could use android:layout_marginTop="??" within the Textview.
Alternately you could use android:gravity="center_vertical" within the Textview. Probably the latter.
i.e.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:layout_gravity="center_vertical"
android:text="Sex:" />
<RadioGroup
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:id="#+id/input_button_male"
android:paddingRight="10dp"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:id="#+id/input_button_female"
android:paddingRight="10dp"/>
</RadioGroup>
</LinearLayout>

Do you want like this then put in your textview below code
android:layout_gravity="center_vertical"

Check this out!
android:layout-width="0dp" not recommended! Prefer androd:layout-width="wrap_content"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_marginLeft="48dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="0.4"
android:text="Sex :"
android:textSize="20sp" />
<RadioGroup
android:layout_marginRight="72dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="horizontal">
<RadioButton
android:id="#+id/input_button_male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:text="Male" />
<RadioButton
android:id="#+id/input_button_female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:text="Female" />
</RadioGroup>

Related

LinearLayout with TextView on the left and RadioButton on the right?

Good afternoon,
I am trying to do an alignment like this one :
http://i.imgur.com/ArAEiZC.png
To do it I tried the following code :
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="0sp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dark background"
android:textAppearance="#style/TextAppearance.AppCompat.Title" />
<RadioButton android:id="#+id/radio_darkbackground"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"
android:layout_gravity="right"
android:gravity="right"/>
</LinearLayout>
As you can see, I put the layout_gravity and gravity on "right" but it does not work and look like this :
http://i.imgur.com/JDzwEJI.png
change your code to this:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dark background"
android:textAppearance="#style/TextAppearance.AppCompat.Title" />
<RadioButton android:id="#+id/radio_darkbackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"
android:layout_gravity="right"/>
</FrameLayout>
Try This
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="0sp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dark background"
android:textAppearance="#style/TextAppearance.AppCompat.Title" />
<RadioButton
android:id="#+id/radio_darkbackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_gravity="right"
android:gravity="right"
android:onClick="onRadioButtonClicked" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dark background"
android:textAppearance="#style/TextAppearance.AppCompat.Title"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"></View>
<RadioButton
android:id="#+id/radio_darkbackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"/>
</LinearLayout>

Can i have a Linear layout inside RadioGroup to hold radio button?

I want to have a Customized Radio Group view. So i have created xml view as below
<RadioGroup
android:id="#+id/selectUserRadioBtnContainer"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="30dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="14sp"
android:fontFamily="normal"
android:layout_gravity="left|center_vertical"
android:text="#string/btnTextAddPic"
android:cropToPadding="true"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:textColor="#ffffff"
android:background="#drawable/profile_pic_rounded_background" />
<TextView
android:id="#+id/txtUserFullName"
style="#style/reviewInputLabels"
android:layout_width="0dip"
android:layout_height="30dp"
android:textColor="#33B5E5"
android:gravity="center_vertical|left"
android:textSize="16sp"
android:layout_weight="1"
android:text="Patient Name"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:tag="MAINUSER"
style="#style/radLabel"
android:button="#drawable/button_radion_default_custom" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="30dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:textSize="14sp"
android:fontFamily="normal"
android:layout_gravity="left|center_vertical"
android:text="#string/btnTextAddPic"
android:cropToPadding="true"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:textColor="#ffffff"
android:background="#drawable/profile_pic_rounded_background" />
<TextView
android:id="#+id/txtUserFullName"
style="#style/reviewInputLabels"
android:layout_width="0dip"
android:layout_height="30dp"
android:textColor="#33B5E5"
android:gravity="center_vertical|left"
android:textSize="16sp"
android:layout_weight="1"
android:text="Patient Name"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:tag="MAINUSER"
style="#style/radLabel"
android:button="#drawable/button_radion_default_custom" />
</LinearLayout>
</RadioGroup>
Is this a right way to do?. The problem that I am facing is Radio buttons are not considered as children of Radio Group. Can anybody help me out with this ?
Try this for placing text and image on left of radio button
<RadioButton
android:id="#+id/rbtnid"
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="rtext"
android:gravity="center|right"/>
Hope it helps.

aligning radio buttons in android

I am trying to re arrange the radio buttons
I have a output
search_page.xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:background="#E1E1E1"
android:weightSum="1" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="City" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext"
android:layout_weight=".75" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="selectDate"
android:orientation="horizontal"
android:padding="10dp"
android:background="#E1E1E1"
android:weightSum="1" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="date" />
<EditText
android:id="#+id/DATE_EDIT_TEXT_ID"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight=".75"
android:background="#drawable/rounded_edittext"
android:onClick="selectDate" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:background="#E1E1E1"
android:weightSum="1" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="type" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio0"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Breakfast" />
<RadioButton
android:id="#+id/radio1"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lunch" />
</RadioGroup>
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:text="Dinner" />
</LinearLayout>
to space the radio buttons in order as below !
Any ideas !
Copy the below code in your xml.I have changed weight distribution in layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="2.5" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="type" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:checked="true"
android:padding="5dp"
android:text="Breakfast" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:padding="5dp"
android:text="Lunch" />
</RadioGroup>
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:padding="5dp"
android:text="Dinner" />
</LinearLayout>
Hope this works
I would suggest not to use radioGroup for horizontal. i have found that there are issues on different devices when doing this (Galaxy Note 2 was one of these devices more recently).
Just use a horizontal linear layout, push it left with margins to align it and put buttons inside it which will have text and your background shape.
Then in code add click listeners to them, and have a way to save which button was last clicked.
you can have the state drawable contain a selected="true" state and call button.setSelected(true or false) to get it to show up as selected or deselected.

Great distribution of horizontal radio buttons

I have 3 RadioButton in one line (linearLayout). I want to distribute them properly in the line, and not align all of them to the left, just as in this screenshot.
Currently it is displayed like this:
XML:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/linearLayout2"
android:layout_alignLeft="#+id/linearLayout2" android:id="#+id/linearLayout3">
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yes"
android:id="#+id/radioButton3" android:layout_gravity="center_horizontal|top" android:checked="false"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Maybe"
android:id="#+id/radioButton" android:layout_gravity="center_horizontal|top" android:checked="true"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No"
android:id="#+id/radioButton2" android:checked="false"/>
</RadioGroup>
</LinearLayout>
It is possible for classic buttons with 0dp (see here), but RadioButtons are invisible with this setting.
Is there an easy way to do that ?
Try this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout2"
android:layout_below="#+id/linearLayout2" >
<RadioGroup
android:layout_width="fill_parent"
android:weightSum="3"
android:layout_height="fill_parent" android:orientation="horizontal">
<RadioButton
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Yes"
android:id="#+id/radioButton3" android:checked="false"/>
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Maybe"
android:layout_weight="1"
android:id="#+id/radioButton" android:checked="true"/>
<RadioButton
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="No"
android:id="#+id/radioButton2" android:checked="false"/>
</RadioGroup>
</LinearLayout>
Then you must have to use layout weight on you radio button:-
android:layout_weight beginner's question
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/linearLayout2"
android:layout_alignLeft="#+id/linearLayout2" android:id="#+id/linearLayout3">
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="horizontal">
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Yes"
android:id="#+id/radioButton3" android:layout_gravity="center_horizontal|top" android:checked="false"/>
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Maybe"
android:id="#+id/radioButton" android:layout_gravity="center_horizontal|top" android:checked="true"/>
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="No"
android:id="#+id/radioButton2" android:checked="false"/>
</RadioGroup>
</LinearLayout>

Trying to align radio buttons in RadioGroups in compound layout

I have this layout fragment. Why aren't the two radio groups aligned? I've tried with and without margin and padding in the RadioGroup.
I'm assuming that marginLeft is measured from the left edge of the radio button itself and marginRight is measured from the right of the longest radio button caption. The documentation is not clear in this respect.
Note that I've deleted any lines not related to layout (e.g. text). All text sizes are 15sp.
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/lengthImage"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="#string/length"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/lengthImage"
android:paddingLeft="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioGroup
android:orientation="vertical"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="200dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="#+id/lengthMetres"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="#+id/lengthFeet"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RadioGroup>
</RelativeLayout>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:id="#+id/distanceImage"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="#string/distance"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/distanceImage"
android:paddingLeft="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioGroup
android:orientation="vertical"
android:layout_marginLeft="200dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="#+id/distanceMile"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="#+id/distanceKM"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="#+id/distanceNM"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RadioGroup>
</RelativeLayout>
[EDIT]
Solution.
Hard coding the RadioGroup widths to 100dp works perfectly. I hate doing this though. I bet there's a combination of resolution, density and orientation out there that will break this!
You can fully build your layout without hard coding the 100dp.
By making few tricks with android:layout_alignLeft, android:layout_alignBottom and android:layout_alignTop you can solve your problem with the RadioGroups.
But, you will have to change the XML a little bit, because it will work only if both RadioGroups are in the same RelativeLayout.
This is your code with all adjustments:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioGroup
android:id="#+id/radio_group_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="200dp"
android:orientation="vertical" >
<RadioButton
android:id="#+id/lengthMetres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="metres" />
<RadioButton
android:id="#+id/lengthFeet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="feet" />
</RadioGroup>
<ImageView
android:id="#+id/lengthImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignBottom="#id/radio_group_1"
android:layout_alignTop="#id/radio_group_1"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:src="#drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/radio_group_1"
android:layout_alignTop="#id/radio_group_1"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/lengthImage"
android:gravity="center"
android:paddingLeft="15dp"
android:text="#string/length" />
<RadioGroup
android:id="#+id/radio_group_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/radio_group_1"
android:layout_below="#id/radio_group_1"
android:orientation="vertical" >
<RadioButton
android:id="#+id/distanceMile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="mile" />
<RadioButton
android:id="#+id/distanceKM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="km" />
<RadioButton
android:id="#+id/distanceNM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="NM" />
</RadioGroup>
<ImageView
android:id="#+id/lengthImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignBottom="#id/radio_group_2"
android:layout_alignTop="#id/radio_group_2"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:src="#drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/radio_group_2"
android:layout_alignTop="#id/radio_group_2"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/lengthImage"
android:gravity="center"
android:paddingLeft="15dp"
android:text="#string/length" />
</RelativeLayout>
And this is how it looks:
I think, that this solution in your specific case is applicable, but for some kind of generic solution, when you have more then two RadioGroups this solution will have to be improved.
Hope this approach could be useful for you :)
Looks like you should use android:layout_width="match_parent" and android:layout_marginLeft="200dp"(not android:marginLeft) for your RadioGroups.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/lengthImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/lengthImage"
android:paddingLeft="15dp"
android:text="length" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="200dp"
android:orientation="vertical" >
<RadioButton
android:id="#+id/lengthMetres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="meters" />
<RadioButton
android:id="#+id/lengthFeet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="feets" />
</RadioGroup>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/distanceImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/distanceImage"
android:paddingLeft="15dp"
android:text="distance" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="200dp"
android:orientation="vertical" >
<RadioButton
android:id="#+id/distanceMile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingRight="20dp"
android:text="foo" />
<RadioButton
android:id="#+id/distanceKM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="boo" />
<RadioButton
android:id="#+id/distanceNM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="moo" />
</RadioGroup>
</RelativeLayout>

Categories

Resources