checkbox大小调整 样式设置

来源:互联网 发布:广州数控编程实例 编辑:程序博客网 时间:2024/05/22 06:23
        <CheckBox
            android:id="@+id/checkBox1"
            style="@style/CustomCheckboxTheme"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="10dp"
            android:clickable="false"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:scaleX="2"
            android:scaleY="2" >

        </CheckBox>


样式:

    <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
        <item name="android:button">@drawable/checkbox_style</item>


    </style>

下面是背景文件:

<?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/nocheck" android:state_checked="false"/>
    <item android:drawable="@drawable/nocheck"/>


</selector>

0 0