In my Android Application I have to use a radio button. I need to make the size of the radio button small. So I created a drawable like this
<item android:state_checked="true" android:drawable="@drawable/btn_check_on" />
<item android:state_checked="false" android:drawable="@drawable/btn_check_off" />
Normal way the radio button look like this
but with the small icon, it have a space in between the Text and the button like this, as the button size has make small
Does anyone have any Idea of 开发者_JAVA技巧how to avoid the space(Image2) in between text and the button and to make it just look like image1.
This is done by modifying the paddingLeft
attribute on the RadioButton
. The default padding is enough to make the button clear the text, as shown in your first image. I'd start with android:paddingLeft="0dp"
which will put the button on top of the text, and experiment from there.
<RadioButton
android:id="@+id/radioButtonHello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello!"
android:paddingLeft="0dp"/>
It can be done but is not as simple as setting the Layout_Width and Layout_height as with Edit Texts, Buttons etc. To modify the size/looks of a view like a check box/radio button use the "Background" and "Button" properties to specify your own drawable.
but thistle give you an idea : http://www.anddev.org/tutorial_change_look_of_checkbox-t4553.html
精彩评论