I want my radio button to align automatically without specifying dp, how to do that?
In the below sample example, Radio button width 80 and height 70 is set. Instead i want to do this like fill_parent or wrap_content. How can i do?
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:checkedButton="@+id/allcontacts"
android:id="@+id/contactgroup">
<RadioButton android:id="@+id/allcontacts"
android:width="80dip"
android:height="70dip"/>
<RadioButton android:id="@+id/categories"
android:width="80dip" android:height="70dip" />
<RadioButton android:id="@+id/favourites"
android:width="80dip" android:height="70dip" />
Wrap the buttons in a LinearLayout (horizontal) with a layout_width of match_parent.
For each button set the layout_height to wrap_content, set the layout_width to 0dp and set layout_weight to 1 and they will all be the same size.