1
我想将自定义设计的复选框添加到对话框。对话框视图设置为TableLayout,行数是动态的。正常的复选框太大,所以我创建了不同的状态可绘制的自定义选择器(checkbox.xml):Android - 动态,未聚焦的复选框看起来不正确
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/checkbox_on_background_focus_yellow"/>
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/checkbox_off_background_focus_yellow"/>
<item android:state_checked="false" android:drawable="@drawable/checkbox_off_background"/>
<item android:state_checked="true" android:drawable="@drawable/checkbox_on_background"/>
,并把它添加到我的自定义复选框的构造函数:
setButtonDrawable(R.drawable.checkbox);
如果该复选框的重点似乎一切正常,但不是看起来回落到默认布局:
我已经玩了xml和切换/添加了一些状态,但似乎没有任何工作。
如何解决这个问题,以便在复选框没有焦点的情况下使用我的图像,并且表单元格中的内容不像默认复选框那样大?
由于提前, 丹尼
谢谢您的回答,但我已经尝试过在btn_check.xml每可用状态(DSK复选框的默认布局),并与我的价值观交换了这一点,但运气NJO此。 – danny