本文介绍了在 android 中使用矢量图像在 Real Device 上出现问题.SVG-安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 https://github.com/pents90/svg-android
中的 svg-android.jar
工作正常,但仅在 eclipse 中的模拟器设备上使用.啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊在真实设备上,它只是在屏幕上清空 imageView
.这是我的代码:
I use svg-android.jar
from https://github.com/pents90/svg-android
at its work fine but only on emulator devices in eclipse. Agrrrr. On real devices it just empty imageView
on screen.here is my code:
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.test);
Drawable drawable = svg.createPictureDrawable();
imgView.setImageDrawable(drawable);
有什么建议吗?
推荐答案
在默认开启硬件渲染的较新设备上,需要显式开启软件渲染.
On newer devices that have hardware rendering turned on by default, you need to explicitly turn on software rendering.
imgView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
我怀疑这可能是你的问题.
I suspect this is probably your problem.
这篇关于在 android 中使用矢量图像在 Real Device 上出现问题.SVG-安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!