set bitmap to background of ImageView with imageView.setImageBitmap method

前端 未结 6 972
野趣味
野趣味 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 15:58

    I have tested and it's done

    I think you are getting Bitmap

    So you have to convert Bitmap to BitmapDrawable

    like

      BitmapDrawable ob = new BitmapDrawable(getResources(), bitmap)
    

    then just set bitmap with below function

      imageView.setBackground(ob);
    

    by this way you can do it..

提交回复
热议问题