Issue with ComposeShader on Android 4.1.1

十年热恋 提交于 2019-11-30 11:29:10

Found the problem: Seems that it has to do with the hardware acceleration. As described here 'ComposeShader can only contain shaders of different types (a BitmapShader and a LinearGradient for instance, but not two instances of BitmapShader)'. But, 'If your application is affected by any of these missing features or limitations, you can turn off hardware acceleration for just the affected portion of your application by calling setLayerType(View.LAYER_TYPE_SOFTWARE, null).'

I saw, that this method is available since SDK 11. My App supports all versions starting with SDK 7, so I have to check if the method is available:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

Now everything's fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!