Rhy*_*boy 6 android handler imageview android-glide
我正在使用Glide作为我的图像加载器,并希望图像在背景中淡出.我遇到的问题是,一旦图像显示一次,它就没有动画效果.
int i = 0;
int[] images = {
R.drawable.sunset1,R.drawable.sunset2,R.drawable.sunset3
};
if(i < images.length - 1){
i++;
}else{
i = 0;
}
Glide.with(MainActivity.this).load(images[i]).placeholder(imageView.getDrawable()).crossFade(1000).into(imageView);
Run Code Online (Sandbox Code Playgroud)
这看起来是 Glide 的预期行为。如果你查看该animate方法的源代码,注释中有这样的文字:
仅当资源异步加载时才会运行(即不在内存缓存中)
要解决这个问题,您只需使用该ImageView#startAnimation方法即可使图像具有动画效果。
| 归档时间: |
|
| 查看次数: |
2831 次 |
| 最近记录: |