Question

I have trouble making borders for android views

What I try to do for simulating a border is to create a view with the main background, then create a view around it with the border color as the background. the first view then has a padding around it, but the wrapping border view still does not show reliably

How do I fix this problem and what is a better way to add a border color around an element?

Was it helpful?

Solution

You can define a Shape (make it a rectangle, define a stroke) and use that shape as the background of yout view. You can also define rounded corners.

If you need something more elaborated, you can make a 9-patch image and use that as the background.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top