Android Question Gravity Center & Right

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all, i'm trying to do this stupid thing, but i don't find nothing. How to set label.gravity to vertical center and right? Thanks
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
This sems to works, but i don't know why, i have a strange effect.

If i add label in this way, works
B4X:
p.AddView(lbl,16dip,0,p.Width,-1)

Works
B4X:
p.AddView(lbl,16dip,0,-1,-1)

Doesn't work
B4X:
p.AddView(lb,16dip,0,p.Width-16dip,p.Height)


I don't understand why it is related...
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
You should use Bit.Or to combine gravities:
B4X:
label1.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.Right)
It is possible that sum will also work with these values however it may fail in other cases.
I tried also it, but i have the same strange issue..
 
Upvote 0
Top