To make Button,TextView,Images and other android components looks better and stylish, we create Gradient drawable.
For using Gradient drawable, we can make shading effects and make better GUI.
We need to create drawable folder inside the res folder of your project and create xml for the gradient.
Here I am sharing 2 examples.
1. Shading1.xml
<!--?xml version="1.0" encoding="utf-8"?-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:startcolor="#571843"
android:endcolor="#D33EA4"
android:angle="270">
</gradient></shape>
</item>
</selector>
2. shading2.xml
<!--?xml version="1.0" encoding="utf-8"?-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:startcolor="#D33EA4" android:endcolor="#571843" android:angle="270">
</gradient></shape>
</item>
<<selector>
We apply this on your like this
<Button
android:id="@+id/gradientButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:background="@drawable/shading1"
0 Comment(s)