0

This is the result and this is not what is desired. The text should be aligned to the left. the checkbox should be aligned to the right. The extra long text should be slightly squished so that there is room for the radiobutton on the right.

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:layout_margin="10dp"
android:padding="5dp">

<TextView android:id="@+id/itemCaption"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true" 
    android:textSize="13dp"
    android:textColor="#feee"/> 

<RadioButton
    android:id="@+id/itemRadioBox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
     android:layout_marginRight="5dp"
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" 
    android:layout_toRightOf="@+id/itemCaption"
    android:text="" />

</RelativeLayout>

How do I fix it to display as desired?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
CQM
  • 42,592
  • 75
  • 224
  • 366

1 Answers1

1

Your line

android:layout_toRightOf="@+id/itemCaption"

takes precedence over your line

android:layout_alignParentRight="true"

try removing the android:layout_toRightOf="@+id/itemCaption" line!!!

trumpetlicks
  • 7,033
  • 2
  • 19
  • 33
  • huh? you pasted the same thing twice – CQM Jun 07 '12 at 19:42
  • this won't solve the problem for the large paragraph text at the bottom, it will bleed into the other radiobox, instead of being aligned to the left of it – CQM Jun 07 '12 at 19:43
  • In this case, you may have to have 2 relative layouts and the text view within a parent relative layout to solve this. Have a relative layout for each radio button / label pair, and place the final textview bottom relative to the bottom most inner relative layout. If this doesn't help, I may need to see you full xml file to further aid you. – trumpetlicks Jun 07 '12 at 19:48