Android ExpandableListView indicator/icon always stretched

hzxu picture hzxu · May 30, 2011 · Viewed 8.3k times · Source

I use my own icon image as indicator for ExpandableListView, but the icon seems to be stretched, I tried to put the image file in /drawable and /drawable-hdpi with no luck. If I do not use my own icon, the built-in Android one looks nice, so I wonder is there any restriction on image dimension, or is there anything I've done wrong?

Thanks!

Answer

Himanshu Likhyani picture Himanshu Likhyani · Aug 29, 2012

group_indicator.9.png

Whatever image you are using as your group indicator, make it a 9 patch (xxx.9.png) image and set its stretchable areas to around the border pixels (which probably may be transparent). It will prevent stretching of image from the middle.