Android Question Why can't gradient drawable have a border.

rgarnett1955

Active Member
Licensed User
Longtime User
Hi

I'm annoyed. I know I shouldn't be but I am.

I can have a view with a flat color and a border with different colors and rounded corners. But I can't have a gradient with borders at all unless I write code.

Boring.

Everyone want's gradients AND borders, but putting a rounded border on an object set for ColorGradient is like trying to fuse two hydrogen atoms together at 20 degrees C.

You only have to look at the number of questions on the forum about it to see that I'm not Robinson Crusoe here.

I understand that because Apple doesn't like borders everyone else thinks that no borders is wonderful, but Apple Phones and Computers don't do anything, they are only useful as a statement about how cool their owners are. Cool, rich, and dumb.

Borders show the user where a control starts and ends and providing you don't go mad with them and you use pastel colors for them, they enhance the user experience in a practical way rather than as an adjunct to style.

Why is it when I select ColorGradient I don't get borders?

What's going on?

Best regards
Rob
 

rgarnett1955

Active Member
Licensed User
Longtime User
Hi Erel

I know that; but if I want a gradient background and set the panel to GradientDrawable in the designer the border option disappears. I didn't believe it at first, I thought I was dreaming. But that's what happens. I just wanted to understand why that is. I would have thought that as an object can have it's own built-in border with a solid color it should do the same with a gradient color. It's only the color fill of the object that is being changed so why can't it "keep" it's border.

So you have to add another panel which had solid color with an alpha of zero with a rounded rectangle border. Doing this manually or in the code takes time to do; something that would take ten seconds in the designer. If you have different types of views to maintain consistency across the app you have to do the following with every one of them.

  • Create panel to hold the view with GradientDrawable - to get a gradient background
  • The view itself i.e. spinner, editbox, label
  • A solid color alpha zero - panel to provide the rounded rectangle border.
This is magnum tedious.

I have attached a screen shot of a toolbar with and without the border panel.

I guess the question I have is is it worth me putting a wish for this in the wish list or is it just not possible to have a GradientDrawable with a border and rounded corners?

Best regards
Rob
 

Attachments

  • Borders_001.png
    Borders_001.png
    76.1 KB · Views: 192
Upvote 0
Top