user3431664
user3431664

Reputation: 51

draw a horizontal line that is gradient/faded in color at both ends

i would like to draw a line 1px wide that is gradient at both ends. I can use an image instead but would like to do this with xml drawing in a relative layout.

Upvotes: 2

Views: 1233

Answers (1)

AllDayAmazing
AllDayAmazing

Reputation: 2383

You could do something like this in the <shape> XML:

<gradient
    android:angle="0"
    android:startColor="#000000"
    android:endColor="#000000"
    android:centerColor="color_you_want" />

And then set your view to use the drawable as a background, 1dp thick

Upvotes: 4

Related Questions