Atharv Vishwas Gupta
3 прихильники(ів)
How to Add a Linear Gradient Background ...

How to Add a Linear Gradient Background in Android Studio

Aug 03, 2021

Hi there! In this post, I will tell you how to add a linear gradient background to an activity in android studio. The steps are listed below:

  1. Create a new file in the drawable folder called background.xml. Set the Root element to 'shape'

    зображення

  2. Add the following code:

    <gradient
        android:startColor="#0D973B"
        android:endColor="#1295B6" />

    The gradient element allows us to make a gradient.

  3. To add the gradient to your activity, add the background attribute in the head element. Set the value of the background attribute to "@drawable/background"

    android:background="@drawable/filename"

    зображення

So this is how you add a linear gradient background to an activity. If this post helped you, consider getting me some books. Bye for now.

Подобається цей допис?

Купити для Atharv Vishwas Gupta книга

Більше від Atharv Vishwas Gupta