set bitmap to background of ImageView with imageView.setImageBitmap method

前端 未结 6 964
野趣味
野趣味 2021-01-31 15:16

I have an ImageView. I am using imageView.setImageBitmap to set my image as background to ImageView. But it sets my image to ImageVi

6条回答
  •  孤街浪徒
    2021-01-31 16:11

    Try following code to set your own bitmap as background.

    Bitmap bitmap = ...;
    ImageView imageView = ...;
    Drawable drawable = new BitmapDrawable(getResources(), bitmap);
    imageView.setBackground(drawable);
    

提交回复
热议问题