radioButton 遇到的问题

来源:互联网 发布:windows打开资源管理器 编辑:程序博客网 时间:2024/05/19 16:34

radioButton 遇到的问题

  1. radioButton 让内容居中
    在RadioButton中设置属性 android:paddingLeft=”0dp” 或者 android:background=”@color/transparent” 都可以让按钮居中,两个使用其中之一就可以了
  2. 去掉默认的圆圈
//首先设置默认背景为空            android:button="@null"            //设置顶部图片,这里为一个选择器            android:drawableTop="@drawable/main_home_select"            android:text="首页"            //设置文字颜色,这里为一个选择器            android:textColor="@drawable/main_rd_text"            //设置居中            android:gravity="center"

动态设置

radioButton.setButtonDrawable(android.R.color.transparent);            radioButton.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.tab_icon_me), null, null);
0 0
原创粉丝点击