0

Hello I want to know how I can get background effect like this ? Even the colours are different with different contacts.

I have tried some tutorials.

  1. this
  2. this

and others.

But did not get exact effect. Please help. Thanks in advance. :)

Community
  • 1
  • 1
Dhaval
  • 1
  • 1

2 Answers2

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

and then in your main xml

 <include
        android:id="@+id/include1"
        layout="@layout/actionbar" />
Dhara Patel
  • 359
  • 5
  • 19
0

for example in XML

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#2E383E"
        android:endColor="#798B97"
        android:angle="45"/>    
</shape>

Create a TransitionDrawable to change between two drawables that you use for the background.

<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- use whatever drawables you want, gradients, shapes etc-->
    <item android:drawable="@drawable/start" />
    <item android:drawable="@drawable/end" />
</transition>

Transition Drawables in Android

TransitionDrawable trans = (TransitionDrawable) myLayout.getBackground();
trans.startTransition(2000);
Kunal Vaja
  • 46
  • 1