I went through many threads but i could not get the answer yet .
I am setting an image to the imageView programmatically as
imageview.setBackgroundResource(R.Drawable.image);
if i set image as the above , will the image get cleared if i give
imageview.setImageDrawable(null);
what does imageview.setBackgroundDrawable(null)
meant ?
What is the difference between
imageview.setImageDrawable(null);
and
imageview.setImageBitmap(null);
and
imageview.setBackgroundDrawable(null);
setBackgroundDrawable()
is deprecated. You should use setBackground
instead.
Basically the difference is the parameter. In setImageBitmap()
you have to pass a Bitmap object. In setImageDrawable()
you have to pass a Drawable
object. setBackground just change the background of the imageview.
The imageview can have a background and a image content. If you are defining the background and want to clear the imageview, you should use setBackground(null)
.
Did you tried with :
imageview.setImageResource(android.R.color.transparent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With