Hey, I want to make the Text of a RadioButton appear on the left side of the RadioButton.. so I tried using 2 relative views (I have 2 RadioButtons) and it worked but the problem is in RadioGroup not working properly.. Heres the code:
<RelativeLayout android:id="@+id/SearchRelative"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RadioButton android:checked="true"
android:id="@+id/SearchRadioButtonAloneWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
</RadioButton>
<TextView android:text="1"
android:layout_toLeftOf开发者_如何学Go="@+id/SearchRadioButtonAloneWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</RelativeLayout>
<RelativeLayout android:id="@+id/SearchRelative"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RadioButton android:id="@+id/SearchRadioButtonInBetweenWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
</RadioButton>
<TextView android:text="2"
android:layout_toLeftOf="@+id/SearchRadioButtonInBetweenWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</RelativeLayout>
They get displayed properly with the text on the left side of its RadioButton.. but the RadioGroup doesnt work!
Edit1: is it possible to dynamically add RadioButtons to a group? thats one way of fixing my problem!
Regarding using layout managers inside a RadioGroup: sorry, it doesn't work that way. As far as I know, if something is added to a RadioGroup which is not an instance of RadioButton, it is not managed by this RadioGroup. But this presents an alterntive solution to the problem: extending RadioButton to draw it the way you want.
As for dynamic manipulation: yes, this is possible with RadioGroup just like with any other ViewGroup. All you have to do is to add RadioButtons via RadioGroup.addView().
加载中,请稍侯......
精彩评论