I have a SimpleDraweeView and can display an image correctly by:
SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.hotel_image_view);
draweeView.setImageURI(uri);
but sometimes i want to use a local image like @drawable not from a URL, but setImageBitmap
or setImageResource
can't be used:
draweeView.setImageBitmap(R.drawable.test_image);
How could i do this? Use an ImageView
under SimperDrweeView
hide/show by some condition to use local image? Thanks.
You can put a @drawable in a Fresco image request. This is one way:
ImageRequest request =
ImageRequestBuilder.newBuilderWithResourceId(R.drawable.test_image)
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(draweeView.getController())
.build();
draweeView.setController(controller);