Reputation: 1822
I am currently designing a login page and I've run into a problem with using rounded rectangles. My current layout looks somewhat like this:
It's a rounded rectangle containing a smaller rounded rectangle.
As you can see, the right edges of both rectangles seem to merge. However, I want to maintain a constant distance between the borders of the two rectangles for a crisper look. Is there any way I can do this?
Upvotes: 4
Views: 466
Reputation: 11514
In order to do that, the rectangles need to have the same radius on each corner.
If the corners of the outer rectangle have a 10dp radius, the inner rectangle should also have a 10dp radius.
Edit:
You also need to have the same padding/margins on the top, bottom and right side of the inner rectangle. Check your margins and paddings so they add up to the same value.
Upvotes: 1
Reputation: 8533
On the EditText
you may want to try layout_marginRight
in the XML.
Upvotes: 2
Reputation: 24235
If your outer rect is outerRect
and already contains the coordinates, then you can set the bounds of the inner rect relative to the outerRect
's bound.
Rect innnerRect = new Rect(outerRect.left+5, outerRect.top+5,
outerRect.right-5, outerRect.bottom-5);
You can also make the image a 9-patch drawable. Define the middle of inner rect area as stretchable.
Upvotes: 1