相关疑难解决方法(0)

Android imagebutton以编程方式更改?

您好我有一个图像按钮linearButton,它在XML中有一个背景可绘制集.我想有条件地替换代码中的背景,但它永远不会发生!

Drawable replacer = getResources().getDrawable(R.drawable.replacementGraphic);
linearButton.setBackgroundDrawable(replacer);
Run Code Online (Sandbox Code Playgroud)

这似乎是无效的,是否有一个图像按钮的"重新加载"功能,我必须在视觉上改变之前调用它们?

xml android imagebutton drawable

3
推荐指数
1
解决办法
6992
查看次数

标签 统计

android ×1

drawable ×1

imagebutton ×1

xml ×1