Aligning Label Texts

TedN

Member
Licensed User
Longtime User
Is there a way to set the text in a label say, 10 pixels from the left.
I've checked out label.gravity = gravity. , but find only specific alignments, e.g. left, right, center, etc.

At the moment I'm placing two spaces in front of the text. I don't want to just center the text as I have several labels in a column and would like to align the start of all of the texts.

Thanks,
 

TedN

Member
Licensed User
Longtime User
Erel,
Unfortunately they're not. The labels are inside a panel which is black. The labels are white and slightly smaller than the panel. This gives the illusion of a border around the labels.
I can't therefore make the labels transparent. I can live with placing two spaces before each text but would have preferred a more specific method.

Thanks
 
Upvote 0

TedN

Member
Licensed User
Longtime User
Yes, I'd thought of doing that but I'm dealing with a large number of labels and don't really want to double them.

That's OK, I'll keep adding a couple of spaces. Maybe a later version of B4A will have a numerical indent feature. :sign0060:
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Yes, I'd thought of doing that but I'm dealing with a large number of labels and don't really want to double them.

Android doesn't mind how many views you use (unlike, say, VB6), so that isn't a problem. I have an app with a couple of hundred views in it and it works fine. If you just don't want to have to add them all in Designer manually, you could add them programmatically. Just create an array of all the labels you want to add another label over and then in a loop, add an overlaying label for each one and position it -- just a few lines of code.
 
Upvote 0

TedN

Member
Licensed User
Longtime User
I'm actually creating the original labels through an array so as you say adding additional labels would not be difficult.

Thanks for your help.
 
Upvote 0
Top