I recently wanted to make my status bar color gradient. I know how the WindowManager way works. But I decided instead to find another way to color my statusbar with gradient.
So I did this,
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">@drawable/gradient</color>
<color name="colorAccent">#FF4081</color>
</resources>
@drawable/gradient
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="135" android:startColor="#f56f2c" android:endColor="#fa9f46"/>
</shape>
The @drawable/gradient is the gradient color which I set up. Although IDE said that it is not the right way to do it, but it is worked.
My question: Is it the right way to do it? Does anyone has this experience?