動的に Drawable の色を変更する必要がある場合は、次のように記録します。
/drawble/t_shape.xml に shape を作成します。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/darkBG"></solid>
<corners android:radius="4dp"/>
</shape>
次に、色を動的に変更する必要があります。
まず、Drawable を取得する必要があります。
Drawable tagShapeDrawable = Drawable.createFromXml(context.getResources(), context.getResources().getXml(R.drawable.tag_shape));
そして
tagShapeDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
view.setBackground(tagShapeDrawable);