setBackgroundDrawable和setBackgroundColor的用法

来源:互联网 发布:信息清理软件 编辑:程序博客网 时间:2024/06/07 08:47

1.设置背景图片,图片来源于drawable;

btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_pro));

2.转换字符串为int(颜色);

btn.setBackgroundColor(Color.parseColor("#808080"));

0 0