第一种情况:
GradientDrawable background = (GradientDrawable) titleTextView.getBackground();background.setColor(getResources().getColor(R.color.some_color));
第二种:
GradientDrawable drawable = (GradientDrawable) activity.getResources().getDrawable(R.drawable.blue_square_shape);
动态获取颜色值:
int color = Color.parseColor(String)
网友评论