有没有办法在壁画库中使用 xml 布局而不是层次结构图像?我使用如下布局:
simpledraweeview.getHierarchy().setPlaceholderImage(layout.id);
但它没有用。
这个错误发生了:
.Resources$NotFoundException: 来自可绘制资源 ID #0x7f040049 的文件 res/layout/hierarchy_layout.xml
Fresco 支持在 XML 中设置占位符:http: //frescolib.org/docs/using-drawees-xml.html#_
这意味着您尝试应用的资源不可用。我的建议是你可以试试Picasso library。
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
或者你可以试试Glide library。
Glide.with(myFragment)
.load(url)
.centerCrop()
.placeholder(R.drawable.loading_spinner)
.crossFade()
.into(myImageView);