Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make launcher icon w/ gradient background?

The default Android image studio only lets me choose 1 color as the background for my icon. Is there a way to choose 2 and create a linear gradient effect?

like image 755
AlanSTACK Avatar asked Feb 01 '18 00:02

AlanSTACK


1 Answers

Create an color_gradient.xml in drawable:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <gradient
                android:startColor="@color/start_gradient" <!--Start color of the gradient-->
                android:endColor="@color/end_gradient" <!--End color of the gradient-->
                android:angle="45" /> <!--Change this to see the combination of gradient color-->
        </shape>
    </item>
</selector>

When using for your image:

 android:backgroundTint="@drawable/color_gradient

EDIT:

In case of using Android Image Asset, you still can link the background color to this xml file, to create a gradient background

like image 198
Jacky Avatar answered Oct 10 '22 04:10

Jacky