how to setImage to null in android when the xml has src not null?

后端 未结 4 431
孤街浪徒
孤街浪徒 2021-01-24 19:57

I have this xml



        
4条回答
  •  醉话见心
    2021-01-24 20:36

    Try this..

    Your setting setBackgroundResource that's for android:background="@drawable/icon_on" not for android:src="@drawable/icon_on" background and src both are different use

    imageButton.setImageResource(0);
    

    EDIT

    imageButton.setImageDrawable(null);
    

提交回复
热议问题