Remove background drawable programmatically in Android

前端 未结 11 1568
忘掉有多难
忘掉有多难 2020-12-07 17:17

I want to remove the background drawable @drawable/bg programmatically. Is there a way to do that?

Currently, I have the following XML in my layout:

11条回答
  •  醉酒成梦
    2020-12-07 18:00

    I have a case scenario and I tried all the answers from above, but always new image was created on top of the old one. The solution that worked for me is:

    imageView.setImageResource(R.drawable.image);
    

提交回复
热议问题