I have a custom view which extends TextView and the background is a drawable,
<CustomView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circile_background" />
and want to change the background color in custom view
public class CustomView extends TextView {
TypedArray typedArray;
public CustomView (Context context) {
super(context);
}
public CustomView (Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setColorLevel(int color) {
// update color here
}
}