开发者

Quality of rendering shadow in transparent png on Android

When using a transparent PNG image which has a fine fading shadow always there is an edge line around the shadow on the Android screen. It does not show this in emualator or Exclipse. See photo.

I wonder if there is way to improve on this. Is this something to do with inability of Android screen to show all 24 bit colours or the fact that is scal开发者_如何学编程ing and resampling image?

In this example the image is loaded into an ImageButton view. I tried it as source or background and it is the same quality.

Quality of rendering shadow in transparent png on Android


The artefact you are seeing is known as "banding" and it is a consequence of your display being 16bits per pixel.

The best way to resolve this is to add some "noise" to your image asset in Photoshop or Paint.NET.

Alternatively you can set your window to be 32bpp with the following line added to your activity's onCreate(), between super.onCreate() and setContentView(). :

    getWindow().setFormat(PixelFormat.RGBA_8888);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜