B4J Question Why Can't CENTER ALIGNMENT center multi-line text?

Diceman

Active Member
Licensed User
I find it annoying when I enter more than 1 line of text in a button or a label and want each line to appear CENTER but they display as CENTER LEFT instead.
Is there a workaround for this? Or am I missing something? I wrote a small app to demonstrate this. The output is shown below. Each of the 3 views have the text CENTER aligned, but they are really appear to be CENTER LEFT aligned whenever there is more than 1 text displayed in the view.

TextCenterAlignmentBug.png
 

Attachments

  • TestButtonCenter.zip
    3.1 KB · Views: 31

Diceman

Active Member
Licensed User
Thanks for the reply.
Is this CSS solution of yours cross-platform compatible?

I noticed your example with the yellow buttons are still left justified. Do you know what the CSS command is to center the text?

This is what it should look like:
TextCenterAlignmentExample.png


TIA
 
Upvote 0

oparra

Well-Known Member
Licensed User
Is this CSS solution of yours cross-platform compatible?

No

this use JavaFX CSS


text:

 
Upvote 0

Diceman

Active Member
Licensed User
Unfortunately it has to work on B4J, B4A and B4i. 😞

I would have thought the Alignment property set to CENTER would have handled multiple lines properly.
It looks like I will have to eliminate views displaying more than 1 line of text if I want the text centered properly.
 
Upvote 0

oparra

Well-Known Member
Licensed User
Unfortunately it has to work on B4J, B4A and B4i. 😞

I would have thought the Alignment property set to CENTER would have handled multiple lines properly.
It looks like I will have to eliminate views displaying more than 1 line of text if I want the text centered properly.
if you want cross-platform, you can do it by code using B4Xview
 
Upvote 0

Diceman

Active Member
Licensed User
Thanks for the feedback. I am trying your examples to see how it works.
I also think CharSequence may be the answer. I will have to play with Alignment("ALIGN_CENTER") tomorrow.
 
Upvote 0
Top