Imagebutton change programmatically?

前端 未结 4 855
没有蜡笔的小新
没有蜡笔的小新 2021-02-11 12:08

I\'m trying to change the image of the ImageButton programmatically.

I\'m trying to copy this code, but the setBackgroundDrawable is already deprecated.

         


        
4条回答
  •  梦谈多话
    2021-02-11 12:44

    your code is trying to change the background of the button. not its image. Those are two different things

      ((ImageButton) view).setImageResource(R.drawable.icon2);
    

提交回复
热议问题