【问题标题】:CheckBox with Background color as Pink [closed]背景颜色为粉红色的复选框[关闭]
【发布时间】:2014-01-07 04:21:52
【问题描述】:

我想要背景颜色为粉红色的复选框,选中后颜色应为白色。如何在列表视图中执行此操作???

我想要如下所示的东西!!

http://i.stack.imgur.com/Mmnd6.jpg

提前致谢。

【问题讨论】:

标签: android android-layout checkbox


【解决方案1】:

您可以使用selector 来做到这一点

示例:创建 /res/drawable/checkbox_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:drawable="@drawable/checked" android:state_checked="true"></item>
  <item android:drawable="@drawable/default"></item>

</selector>

然后应用到CheckBox

<CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:button="@drawable/checkbox_bg" />

【讨论】:

  • 这是最简单的方法..nice
  • 这有帮助,这就是我要找的。谢谢
猜你喜欢
  • 2011-10-01
  • 2014-09-24
  • 2019-10-16
  • 1970-01-01
  • 2013-11-29
  • 1970-01-01
  • 2011-07-06
  • 1970-01-01
相关资源
最近更新 更多