mardi 7 mars 2017

Custom checkbox image scale Android Studio

I have made a checkbox in a drawable

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

And I added it to my layout

<CheckBox
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:checked="true"
            android:button="@drawable/checkmusic"
            android:scaleType="fitCenter"
            />

The problem happens when the checkbox's size is less than the images' size. I can only see some part of the image, because it doesn't scales properly. I tried using scaleType, that is used in ImageView, but it doesn't work. Someone knows how could I scale it, so I see all the image in the size I fixed?




Aucun commentaire:

Enregistrer un commentaire