0

我在编辑从 NinePatchDrawable 加载的位图时遇到问题。这是可绘制的(来自 Sherlock 的可绘制 TabWidget 的一部分 - drawable-mdpi/abs__list_pressed_holo_dark):http: //imageshack.us/a/img839/4976/tgt6.png

我想更改除黑白像素外的每个像素:

    int toColor = Color.Red;
    Bitmap src = BitmapFactory.decodeResource(res, resId);
    Bitmap bitmap = src.copy(Bitmap.Config.ARGB_8888, true);

    for(int x = 0; x < bitmap.getWidth(); x++)
        for(int y = 0; y < bitmap.getHeight(); y++){
            if(pixel not black nor white){
                bitmap.setPixel(x, y, toColor);
            }
        }

    byte[] chunk = src.getNinePatchChunk(); 
    return new NinePatchDrawable(res, bitmap, chunk, new Rect(), null);

所以.. 此代码在 Galaxy S2(Jelly Bean)上运行良好,但不适用于 Galaxy Ace 2(姜饼)。新的drawable simple没有改变......有什么问题?

编辑:

上面的代码适用于另一个 Sherlock NinePatchDrawable - abs__ab_transparent_light_holo( http://img802.imageshack.us/img802/7039/otb9.png )...,但不适用于第一个。我再说一遍:这只是发生在姜饼上

4

0 回答 0