jeudi 28 mai 2015

Android custom checkbox drawable sizes

for my custom checkbox I used simple nine-patch which I created using android studio (from png's which were 512x512px).

Here is the xml for custom checkbox:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg">

    <item android:drawable="@drawable/ic_checkbox_unchecked" android:state_checked="false"/>
    <item android:drawable="@drawable/ic_checkbox_checked" android:state_checked="true"/>
    <item android:drawable="@drawable/ic_checkbox_unchecked"/>

</selector>

I've read many threads on this subject, but I found none dealing with size of the chekbox since the size of my new checkbox is big as drawable is. Any attempt to set up fixed size, for example 30x30dp result of drawable being distorted.

So, which size the image drawables should be and if size of the drawables doesn't matter how can I set the size of checkbox to be as the size of standard andorid checkbox?




Aucun commentaire:

Enregistrer un commentaire