vendredi 15 avril 2016

How to change button's size in checkbox

I tried to change Button in Checkbox by using png file, but the image was too big and it made the Button too big.

I want to change the Button's size to 20dp. Then I set layout_width and layout_height in CheckBox, but it didn't solve the problem.

Could you please teach me how to change the size?

<CheckBox
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:text="New CheckBox" 
    android:layout_margin="5dp"
    android:button="@drawable/my_check_box"
    android:layout_weight="1" />

my_check_box.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg">
    <item android:state_checked="false"
        android:drawable="@drawable/checkbox_normal" />
    <item android:state_checked="true"
        android:drawable="@drawable/checkbox_selected" />
</selector>

Aucun commentaire:

Enregistrer un commentaire