You can dynamically change color of any items ( layout, textview ) . Try below code to set color programmatically in layout
in activity.java file
String quote_bg_color = "#FFC107"
quoteContainer= (LinearLayout)view.findViewById(R.id.id_quotecontainer);
quoteContainer.setBackgroundResource(R.drawable.layout_round);
GradientDrawable drawable = (GradientDrawable) quoteContainer.getBackground();
drawable.setColor(Color.parseColor(quote_bg_color));
create layout_round.xml in drawable folder
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorPrimaryLight"/>
<stroke android:width="0dp" android:color="#B1BCBE" />
<corners android:radius="10dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>
layout in activity.xml file
<LinearLayout
android:id="@+id/id_quotecontainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
----other components---
</LinearLayout>