Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 滑动不加载SVG_Android_Kotlin_Svg_Android Glide - Fatal编程技术网

Android 滑动不加载SVG

Android 滑动不加载SVG,android,kotlin,svg,android-glide,Android,Kotlin,Svg,Android Glide,我想显示通过API接收的图像(type=SVG)。出于安全原因,加载时需要身份验证头来获取映像 这是我的模块: @GlideModule @Excludes(OkHttpLibraryGlideModule.class) public class GlideModule extends AppGlideModule { @Override public void registerComponents(@NonNull Context co

我想显示通过API接收的图像(type=SVG)。出于安全原因,加载时需要身份验证头来获取映像

这是我的模块:

@GlideModule
    @Excludes(OkHttpLibraryGlideModule.class)
    public class GlideModule extends AppGlideModule {
    
        @Override
        public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
            Lazy<UserRepository> repository = inject(UserRepository.class);
            registry.register(SVG.class, PictureDrawable.class, new SvgDrawableTranscoder()).append(InputStream.class, SVG.class, new SvgDecoder());
    
            OkHttpClient client = new OkHttpClient.Builder()
                    .readTimeout(15L, TimeUnit.SECONDS)
                    .connectTimeout(15L, TimeUnit.SECONDS)
                    .addInterceptor(new AuthInterceptor(repository.getValue()))
                    .build();
    
            registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
        }
    
        @Override
        public boolean isManifestParsingEnabled() {
            return false;
        }
    }
图像不会显示,但也没有警告/错误消息


我的GlideModule/Binding功能有问题吗?

我认为它不受支持,正如Glide代码所示:

enum ImageType {
  GIF(true),
  JPEG(false),
  RAW(false),
  /** PNG type with alpha. */
  PNG_A(true),
  /** PNG type without alpha. */
  PNG(false),
  /** WebP type with alpha. */
  WEBP_A(true),
  /** WebP type without alpha. */
  WEBP(false),
  /** Unrecognized type. */
  UNKNOWN(false);
列表中没有SVG


然而,有一个名为PainterSVG的应用程序似乎也在使用Glide,我看到了大多数Glide功能,比如占位符、中间位置、缩略图。我不知道他们是如何让它与SVG一起工作的。

不,Glide支持SVG。您可以在官方文档中查看(以下@Manikandan提供的链接)
enum ImageType {
  GIF(true),
  JPEG(false),
  RAW(false),
  /** PNG type with alpha. */
  PNG_A(true),
  /** PNG type without alpha. */
  PNG(false),
  /** WebP type with alpha. */
  WEBP_A(true),
  /** WebP type without alpha. */
  WEBP(false),
  /** Unrecognized type. */
  UNKNOWN(false);