安卓ExpandableListView指示器/图标总是捉襟见肘指示器、捉襟见肘、图标、ExpandableListView

2023-09-05 06:50:24 作者:莫名旳心痛

我用我自己的图标图像作为指标ExpandableListView,但图标似乎被拉长,我试图把图像文件/绘制和/绘制,华电国际,没有运气。如果我不使用我自己的图标,内置了Android一个看起来不错,所以我不知道是否有图像尺寸任何限制,或者是有什么我做错了?

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?

谢谢!

推荐答案

无论图像您使用的是作为你组的指标,使之成为9补丁(xxx.9.png)的图像,并设置其拉伸区域周围边框像素(这大概可以是透明的)。它将prevent从中间延伸的形象。

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.