【问题标题】:Adding Video in Placeholder在占位符中添加视频
【发布时间】:2019-07-04 02:06:02
【问题描述】:

我想在实际图像加载之前使用视频占位符。我正在使用全屏 ImageView 来加载图像,但直到图像加载到 imageview 时,我想在那个地方显示一个占位符视频。我不确定,即使它是否可行。如果在任何情况下都是可行的,就会寻找摆脱这种情况的方法。

【问题讨论】:

  • 为什么要使用视频占位符而不是图像占位符?
  • @ManzurulHoqueRumi 这是一个非常短的视频,展示了加载程序的动画
  • 动画 gif 占位符怎么样?
  • @MidasLefko 如果可以使用,我可以将我的视频文件转换为动画 gif 占位符文件。任何镜头如何在我的情况下使用它?
  • 使用 FrameLayout 和两个孩子:ImageViewVideoView

标签: android imageview placeholder


【解决方案1】:

终于完成了这项工作,我能够使用 Glide 将 GIF 动画用作占位符。 从可绘制资源中加载 GIF 文件。

RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(R.drawable.placeholder);
Glide.with(context)
    .setDefaultRequestOptions(requestOptions)
    .load(articlesListChild.get(position).getArticleImage())
    .thumbnail(Glide.with(context).load(R.drawable.logo_anim_full))  // This line did the magic
    .into(imageContentIv);

【讨论】:

    猜你喜欢
    • 2015-01-23
    • 2019-06-05
    • 2015-08-31
    • 2011-01-04
    • 2021-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多