设置背景时没作用

来源:互联网 发布:vc贪吃蛇c语言代码 编辑:程序博客网 时间:2024/06/08 14:30
View.setBackgroundColor(color);  View.setBackgroundDrawable(R.drawable.shape);

通过代码编写shape,或者通过GradientDrawable设置颜色

GradientDrawable myGrad = (GradientDrawable)rectangle.getBackground();myGrad.setColor(Color.color);

解决办法

原创粉丝点击