Quality of rendering shadow in transparent png on Android

后端 未结 1 1265
逝去的感伤
逝去的感伤 2021-02-04 22:26

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 Exc

1条回答
  •  逝去的感伤
    2021-02-04 23:03

    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 讨论(0)
提交回复
热议问题