![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
如何获取button的背景颜色
1个回答
展开全部
Drawable background = button.getBackground();
ColorDrawable colorDrawable = (ColorDrawable) background;
int color = colorDrawable.getColor();
button1.setBackgroundColor(color);
其实我也不知道咋获取,看到问题之后自行调试了一下,顺着代码走走或许你就会一不小心发现了。
ColorDrawable colorDrawable = (ColorDrawable) background;
int color = colorDrawable.getColor();
button1.setBackgroundColor(color);
其实我也不知道咋获取,看到问题之后自行调试了一下,顺着代码走走或许你就会一不小心发现了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询