我需要在Android中创建具有以下自定义可绘制背景的自定义单选按钮:
我能够为选定和未选定创建不同的可绘制对象。选中时,下面是xml可绘制对象。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:width="20dp" android:height="20dp"/>
<solid android:color="@color/white"/>
<stroke android:width="1dp" android:color="#ff207d94"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<stroke android:color="@android:color/transparent"
android:width="9dp"/>
<solid android:color="#ff207d94"/>
<size
android:width="7dp"
android:height="7dp"/>
</shape>
</item>
我的要求是动态更改所选单选按钮的颜色,即边框和内部的纯色应相同。使用当前的xml,我无法实现此功能,因为item1的笔划颜色为#ff207d94,而item2的笔划颜色为#ff207d94。
我无法在任何地方找到解决此问题的确切方法。有什么办法可以做到这一点?
答案 0 :(得分:1)
您可以尝试
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
答案 1 :(得分:0)
我认为这对您有帮助?
<?xml version =“1.0”encoding =“utf-8”?>
<selector xmlns:android =“http://schemas.android.com/apk/res/android”>
<item android:drawable =“@ drawable / checkbox_pressed“android:state_checked =”true“/>
<item android:drawable =”@ drawable / checkbox_normal“android:state_checked =”false“/>
<item android:drawable =”@ drawable / checkbox_normal“/>
</ selector >
<style name =“CustomCheckboxTheme”parent =“@ android:style / Widget.CompoundButton.CheckBox”>
<CheckBox
android:id =“@ + id / select_all”
android:layout_width =“wrap_content”
android:layout_height =“wrap_content”
style =“@ style / CustomCheckboxTheme”/>
作者:蜗牛
来源:CSDN
原始:HTTPS:///blog.csdn.net/zuolongsnail/article/details/7106586