你好,我有一个imagebutton linearButton
它有一个XML背景可绘制集。我想有条件地替换代码中的背景,但它从来没有发生过!Android imagebutton以编程方式更改?
Drawable replacer = getResources().getDrawable(R.drawable.replacementGraphic);
linearButton.setBackgroundDrawable(replacer);
这似乎是无效的,是有一个imagebuttons,我有他们改变视觉之前所说的“重装”的功能?
你做什么应该工作。向我们展示更多代码,以便我们可以为您提供帮助。 – Gallal
嘿,谢谢它正在工作,我的意思是消除这个问题,但增加的答案也有帮助! – CQM