setBackgroundDrawable和setBackgroundColor的用法


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


 viewHolder.modify.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.btn_fuwu_shape_pre));

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

listItemView.deleteFilghtBg.setBackgroundColor(Color.parseColor("#F5F5DC"));

你可能感兴趣的:(setBackgroundDrawable和setBackgroundColor的用法)