Android Question Transparent Label with visible outline

shashkiranr

Active Member
Licensed User
Longtime User
Hi ,

I have a transparent label but i need to have an white border for the label .

I can achieve the transparency using the alpha control in the designer but i am unable to find out how to get a visible border for the label.

is it possible to do it. ?

Kindly give your inputs

Regards,
SK
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
A method I use is to create a frame out of four labels to surround the transparent label. You can make them as thick or thin as you want and either set them just outside or just inside the edges of the label. And of course you control the colors, Alpha, etc., independently of the label they surround.

There may be a better way to do this, but this has been working for me.
 
Upvote 0

shashkiranr

Active Member
Licensed User
Longtime User
A method I use is to create a frame out of four labels to surround the transparent label. You can make them as thick or thin as you want and either set them just outside or just inside the edges of the label. And of course you control the colors, Alpha, etc., independently of the label they surround.

Thank you for your input, yes it works but it is too tedious because i have around 3 main labels in my screen and i have to create 12 extra border labels to surround them...

Is there any other way??

Waiting for your reply.

Regards,
SK
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I guess tedious is relative. You only have to create them once. The top and bottom edges are the same size, as are the side edges, so at most, you only have to create 6 of your 12 and then copy them. In your code, you position them at the locations of the edges of the transparent labels.

I use such frames in an app that has well over 100 Views in it. That's what I consider tedious; a few more to make a frame is no big deal.

Just speaking for myself -- I've looked at NinePatchDrawable before and I find the method I'm using to be much simpler, but to each his own.

Otherwise, if you are asking if there is a simple command to have a transparent label and turn on a non-transparent frame around it, I'm pretty sure the answer is no.
 
Upvote 0
Top