要解决部分Android 9设备上不显示SVG可绘制对象的问题,可以尝试以下解决方法:
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
然后在代码中使用VectorDrawableCompat来加载SVG图像:
Drawable drawable = VectorDrawableCompat.create(getResources(), R.drawable.your_svg_image, getTheme());
imageView.setImageDrawable(drawable);
implementation 'com.caverock:androidsvg:1.4'
然后在代码中使用AndroidSVG库来加载SVG图像:
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.your_svg_image);
Drawable drawable = svg.createPictureDrawable();
imageView.setImageDrawable(drawable);
请注意,以上示例中的R.drawable.your_svg_image和R.raw.your_svg_image是指向你的SVG图像资源的引用,你需要将其替换为你自己的资源。
这些解决方法应该能够解决部分Android 9设备上不显示SVG可绘制对象的问题。如果问题仍然存在,可能是由于SVG图像本身的问题,你可以尝试使用其他工具或编辑器重新生成或编辑SVG图像。