I was wondering if anyone knows of a tool to generate xml selector files for your custom buttons. I'm getting a bit tired creating buttons, convert them to .9.png files and then copying and pasting a custom selector in xml...
I am aware of these tools:
http://www.androidicongenerator.net/
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
As handy as they are in generating assets/resources, I miss the option to select 4 images and generate a ready-to-use selector xml, which outputs something like:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:state_pressed="true" android:background="@drawable/img_pressed" />
<!-- focused -->
<item android:state_focused="true" android:background="@drawable/img_focussed" />
<!-- default -->
<item android:background="@drawable/img_default" />
</selector>
I am considering in creating one myself, but can't believe no-one already did it :)
Thanks
inspired from this post I made a XML StateList generator, you can find it here, I would love to see if somebody have better generator.
Have a great day!
Made an update to my Android State list generator, now you can make use of all the supported states.
I have created even better tool for generating drawable selectors. It's a Android Studio/IDEA plugin called SelectorChapek. You just click the 'drawable-xhdpi' folder, select 'Generate Android Selectors' and all your selectors appear automagically in the 'drawable' folder! (assuming your resources are appropriately named)
Howto, source & download: https://github.com/inmite/android-selector-chapek
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With