【问题标题】:Increasing the size of the check in Checkbox在 Checkbox 中增加检查的大小
【发布时间】:2014-06-26 01:06:05
【问题描述】:

我想增加复选框中检查的大小。我正在考虑为新支票添加图像。但我在 XML 中看不到任何选项来更改复选框的检查。是否有我缺少的 XML 选项或将新检查图像添加到 java 的方法。

【问题讨论】:

    标签: java android xml checkbox


    【解决方案1】:
    <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/checkbox" android:state_checked="false"/>
    <item android:drawable="@drawable/checkboxselected" android:state_checked="true"/>
    <item android:drawable="@drawable/checkbox"/>    
    

    将其添加到 xml 中的复选框

     <CheckBox
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    **android:button="@drawable/checkbox_selector"**
                    android:text="CheckBox"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="@color/Black" />
    

    【讨论】:

      【解决方案2】:

      您可以通过设置CheckBoxandroid:button 来更改复选框Drawable

      有关如何创建 Drawable 的更多信息,请参阅此答案:https://stackoverflow.com/a/17647520/379245

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-02-09
        • 1970-01-01
        • 1970-01-01
        • 2016-10-08
        • 2010-12-06
        • 1970-01-01
        相关资源
        最近更新 更多