1.设置背景图片,图片来源于drawable;
btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_pro));
2.转换字符串为int(颜色);
btn.setBackgroundColor(Color.parseColor("#808080"));
1.设置背景图片,图片来源于drawable;
btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_pro));
2.转换字符串为int(颜色);
btn.setBackgroundColor(Color.parseColor("#808080"));