Having issue on Real Device using vector image in android. SVG-android(在 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-安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 android 中使用矢量图像在 Real Device 上出现问题.SVG-安卓


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 拆分 Drawable 2022-01-01