代码里面设置布局颜色以及背景图片

代码里面设置颜色

  this.getResources().getColor(R.color.Login_title_bar) 

 用法:

1   title.setTextColor(this.getResources().getColor(R.color.white));
2   layout.setBackgroundColor(this.getResources().getColor(R.color.Login_title_bar)); 

代码里面设置背景图片

1 this.getResources().getDrawable(R.drawable.download_button)

用法

1 holder.mRoundProgressBar.setBackground(context.getResources().getDrawable(R.drawable.download_button));
原文地址:https://www.cnblogs.com/lixiangyang521/p/4708458.html