I want to create vertical gradient separator in android
I am able to create for horizontal separator
but in vertical gradient nothing appears
code for horizontal
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#DEDEDE" android:centerColor="#F52578" android:endColor= "#DEDEDE" /> </shape>
this is how i use in my project
<View android:background="@drawable/divider_gradient" android:layout_width="fill_parent" android:layout_height="1.0px" />
i tried layout_width="1dp" and layout_height="fill_parent" for vertical separator but nothing appears
Designers are trying out different styles and combinations which go best with the Android App. One of the key components of Android being used these days is called GradientDrawable. A GradientDrawable is drawable with a color gradient for buttons, backgrounds, etc.
Gradient basically represents the variation in space(in a direction) of any quantity. With color it represents the variation of color intensity in a direction represented by angle. Here are some diagrams to represent this concept: Here the figure shows the color variation in horizontal direction (angle is set 0).
Use
android:angle="270"
as another attribute in your gradient
to get you start color - center color - end color as Top to Bottom
Make use of Angle attribute to achieve gradient in wanted direction. More at http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With