Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background gradient

Tags:

android

I have a typical login screen(table layout). What I would like to do is draw a rectangle around those controls and put gradient in it. How do I do that in xml ?

like image 584
user533844 Avatar asked Dec 07 '22 19:12

user533844


1 Answers

create gradient.xml in /res/drawable:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#FFFFFF"
        android:endColor="#00000000"
        android:angle="45"/>    
</shape>

and in your layout file add android:background="@drawable/gradient" to the propierties of the container where the controls are put in

like image 176
DonGru Avatar answered Dec 27 '22 23:12

DonGru