2019独角兽企业重金招聘Python工程师标准>>>

自定义RadioButton或CheckBox选择样式

  1. 创建radiobtn_selector.xml,cion_sel_end和un是两张区分是否被选中的图片

<?xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android">
   android:drawable="@mipmap/icon_sel_end" android:state_checked="true" />
   android:drawable="@mipmap/icon_sel_un" android:state_checked="false" />

    2.RadioButton或CheckBox设置属性

android:button="@null"
android:drawableRight="@drawable/radiobtn_selector"

    具体实现:

    android:id="@+id/rb_ali"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:layout_weight="1"
   android:paddingRight="30dp"
   android:button="@null"
   android:drawableRight="@drawable/radiobtn_selector"
   android:gravity="center_vertical"
   android:text="APP"
   android:textColor="@color/black6"
   android:textSize="15dp" />


转载于:https://my.oschina.net/u/2320057/blog/653004

更多相关文章

  1. Android快速开发02之仿京东底部Tab
  2. android 3D gallery 并 判断当前选中项
  3. android 3D gallery 并 判断当前选中项
  4. Android中的ListView实现图片文字和按钮
  5. Material Design
  6. android Multiple markers at this line - The type java.lang.C
  7. Android简单的计算控件使用
  8. Android之Spinner用法
  9. android开关按钮,Switch,ToggleButton,RadioButton,CheckBox ,多种实

随机推荐

  1. 运行时获取Android(安卓)API版本
  2. Android(安卓)TelephonyManager类的介绍
  3. TextSwitcher切换动画
  4. AndroidManifest文件(部分)
  5. MyNotes(ContentProvider实例)
  6. android跑马灯
  7. AlertDialog对话框-自定义View
  8. Android编译环境配置
  9. android界面小程序
  10. Fused Location Provider