Imagebutton change programmatically?

前端 未结 5 1953
天命终不由人
天命终不由人 2021-02-11 12:21

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

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

         


        
5条回答
  •  臣服心动
    2021-02-11 12:28

    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);
    

提交回复
热议问题