This is a gradient rectangle with rounded corners. The corner radious is 5dp and gray turns to completely transparent within 20dp.
How would I make this bitmap programmatically?
( It's important to have the corners do the same gradient color transition circularly. So I cannot use one rectangle gradient overlapping with an oval gradient coz this would create a darker area where the two gradients would overlap )
Related
I want a cardview to look like as in the image below. How to a create shape with rectangle with elongated botton right corner in the drawable and apply it as a background to a cardview? OR is there a better way to achieve this result?
I want to make GradientDrawable for background like the image below.
Linear Gradient with same color in the top and bottom.
I made gradient drawable with start, center and end colors but couldn't set the size of center color.
I also tried <Layer-list> with 2 gradient shape-s but one overlays over the other and either I have gradient on the top or on the bottom.
Can anyone help me ?
use "rect" type ShapeDrawable and ShapeDrawable.ShaderFactory
when implementing ShapeDrawable.ShaderFactory return the LinearGradient using colors array with 4 colors (f.ex: white, dark_blue, dark_blue, white) and positions array with 4 positions (f.ex: 0, 0.2, 0.8, 1)
I'm wondering if that's possible to create an effect as shown at the picture below using only 1 Layout. The "Description" is a separate TextView and not related to the question. So basically I need a rect shape with:
Glowing border (stroke and shadow..?)
Middle rectangle with gradient
Outer rectangle
Any ideas if this could be achieved using only one Layout and XML shape as background?
An ellipse is easy to create. So is a rectangle with rounded corners. But how do I create a velodrome shape?
That is, half a circle to the left + rectangle in the middle + half circle to the right. Like a straight sausage, if you want.
I want this as an XML drawable to be used as background for a TextView.
What you're describing is a rectangle with rounded corners, just a specific class of one. Simply increase the radius of your corners to half the height of your rectangle.
I have some text in a relative layout.I know that we can draw a border with curves using stroke and corner in a separate xml.
Is there a way to apply gradient effect for the border constructed with the stroke? or is there any other way to draw a gradient border?
Thanks in advance.
I don't know of a way to do that trivially, but it seems like you could define two shape drawables and combine with a layer drawable. The bottom one would be a rounded corner rectangle with a gradient, the top one would be a slightly smaller rounded corner rectangle of whatever you wanted the interior color to be. The effect should be something like a stroke gradient, although I haven't tried it.