zoukankan      html  css  js  c++  java
  • 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> 

    其实方法很简单:

    添加个背景图片就搞定了。
  • 相关阅读:
    制作一个html中闪动的title 来提示消息
    Unicode与 utf8的互相转换
    程序员找女友的类
    使用php将数组转为XML
    自己动手画一个HTML5的按钮
    浏览器推通知给桌面
    如何使用定时任务
    封装之property,多态,鸭子类型,classmethod与staticmethod
    面向对象
    继承与派生
  • 原文地址:https://www.cnblogs.com/xuewater/p/2731057.html
Copyright © 2011-2022 走看看