我想使用滑行显示在imageViews中重复的占位符,我可以使用滑行做到这一点
ImageView.setImageDrawable(getDrawablePlaceholder())
但是像使用Glide一样
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(getDrawablePlaceholder())
.fitCenter();
Glide.with(getApplicationContext())
.asBitmap()
.load(url)
.apply(requestOptions)
.into(imageview);
private BitmapDrawable getDrawablePlaceholder() {
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_user);
BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), bmp);
bitmapDrawable.setTileModeX(Shader.TileMode.REPEAT);
bitmapDrawable.setTileModeY(Shader.TileMode.REPEAT);
return bitmapDrawable;
}
背景不重复,占位符仅显示在中心。