I have a Textview with an XML file attached to the background. Now I wanted to change the background of the Textview with setBackgroundColor(), but it doesn't work, because the background color of the XML file has to be changed. How do I change the background color of the my_border XML file?
XML Textview:
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
android:background="@drawable/my_border"
android:text="Hey"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
XML Textview Border file:
<?xml version="1.0" encoding="utf-8"?>
<!-- View background color -->
<solid
android:color="#fff" >
</solid>
<!-- View border color and width -->
<stroke
android:width="1dp"
android:color="#000" >
</stroke>
<!-- The radius makes the corners rounded -->
<corners
android:radius="5dp" >
</corners>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp">
</padding>