Android怎么让RadioButton图片居中显示

通过使用RadioGroup
的button属性后
怎么让radiobutton 显示的图片居中.使用android:backgroud方法图片会变形。无奈使用android:drawableTop.但是该图片是靠右侧的。
而网上说的
android:button="@null"
android:drawableTop="@drawable/rate_selector" 这个方法试过了,没用
 
如下面的例子:
<RadioButton 
 android:id="@+id/radio_button3" 
 style="@style/main_tab_bottom" 
android:layout_marginTop="2.0dip" 
android:drawableTop="@drawable/icon_4_n"  android:tag="radio_button3" 
android:text="@string/settingtitle" /> 
<style name="main_tab_bottom">  
<item name="android:textSize">@dimen/bottom_tab_font_size</item>  
 <item name="android:textColor">#ffffffff</item>  
 <item name="android:ellipsize">marquee</item>  
 <item name="android:gravity">center_horizontal</item>    
 <item name="android:background">@drawable/home_btn_bg</item>  
<item name="android:paddingTop">@dimen/bottom_tab_padding_up</item>  
 <item name="android:layout_width">fill_parent</item>  
 <item name="android:layout_height">wrap_content</item>  
<item name="android:button">@null</item>    
 <item name="android:singleLine">true</item>  
 <item name="android:drawablePadding">@dimen/bottom_tab_padding_drawable</item>  
<item name="android:layout_weight">1.0</item>  
</style> 

其实方法很简单:

添加个背景图片就搞定了。
posted @ 2012-10-19 14:56  water0504  阅读(8350)  评论(0编辑  收藏  举报