Where are View Properties names

chuck3e

Active Member
Licensed User
Longtime User
I want to change the Horizontal Alignment of the text in a Label but I don't know where to find the KeyWords for the view properties.

I tried using Label1.HorizontalAlignment = "Left" but it got flagged as an unknown member.

Is there documentation listing all the property names.

-Chuck
 

chuck3e

Active Member
Licensed User
Longtime User
giga,
What I failed to mention but thought my example would show was, I want to change this attribute inside the Activity through code.
 
Upvote 0

chuck3e

Active Member
Licensed User
Longtime User
Klaus,
I had already looked through these documents but never saw where the names of these properties. I'm assuming Horizontal Alignment can be changed through program code like Text and other properties can.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Are you looking for something like this via code:
B4X:
Label1.Gravity=Gravity.LEFT
After the second Gravity the intellisense shows you a multitude of selection to choose from.
 
Upvote 0

chuck3e

Active Member
Licensed User
Longtime User
Mahares,
Yes that's what I'm looking for but I'm wanting to change the property "Horizontal Alignment" of a Label from "CENTER_HORIZONTAL" to "LEFT" dynamically within the logic. Most of the time during the execution of this activity I want "CENTER_HORIZONTAL" for this one Label's text but I do have a case where I want that Label's text temporarily
left-justified.

The problem is I can't find what name to use in my code for the Label property Horizontal Alignment.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
The alignment in Android is called Gravity !
So you can change this propety, as already mentioned by Mahares, with Label1.Gravity = xxx
xxx can be any combination of the Gravity object !
If you write in the IDE Label1.Gravity = Gravity. the inline help will show the different possibilities !
You can also combine two values like :
Label1.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL)

Best regards.
 
Upvote 0

chuck3e

Active Member
Licensed User
Longtime User
Klaus,
I see. Odd to my thinking. Thanks for the answer.

Back to my other question: where are these properties documented so that I can find out about things like that. For instance, what if I wanted to change the Vertical Alignment? Where can I read to find that? I looked in both the Beginner and User's Guide but couldn't find anything like that.

-Chuck
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…