I have the following situation: there's a gradient background in my activity:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#0F7D71"
android:startColor="#0E725B"
android:type="linear" />
</shape>
Here's the way how I set this background to my activity:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_gradient_background"
tools:context=".ui.login.LoginActivity">
But I also need to use gradient background in some other screens with other colors. Now I create a new gradient file for each screen, but I don't think that it is the best way. So, can you help me to explain how to pass colors from code to have only one gradient xml for the project. Thanks in advance!