Android Question Bring to front

Stefano Di Chiano

Active Member
Licensed User
Hi,
I'm trying to put a label on a button to show some text on the right side of it. The button's text is on the left, so I can't change the alignment. I can't find a way to do so though.
I set the label higher than the button in the designer's views tree, and it actually shows the label on top of the button, but when I run the app, the label is put below, even if I use the bringtofront function.
Are there any ways to achieve this? How can I make the label to appear on top of the button?
 

Stefano Di Chiano

Active Member
Licensed User
Put the label inside a (transparent) panel and set its elevation to 2dip or more.
I did this but doesn't work.
After some testing, it appears that only the label's text is not shown, as if I set a background color black, I can see a black square over the button.
EDIT: this happens only once i put the label in the panel. If I don't, the label's text is shown below the button (I saw it by setting button.visible = false).
 
Last edited:
Upvote 0

Stefano Di Chiano

Active Member
Licensed User
Eventually I was able to make the label appear. I put it inside a panel as Erel said. The text was not shown because in the designer script I set the label width and height at 100%, thinking that it would refer to the panel dimensions, but it didn't.
This way it was only shown the top left corner of the label, which hadn't any text in it.
With the following settings though, it worked:
B4X:
btnProfilo.Top = 2%y
btnProfilo.Left = 0%x - 1%x
btnProfilo.Width = 101%x
btnProfilo.Height = 9%y

panelProfilo.Top = btnProfilo.Top
panelProfilo.Left = btnProfilo.Left + 86%x
panelProfilo.Width = 15%x
panelProfilo.Height = btnProfilo.Height

lblProfilo.Top = 0%y
lblProfilo.Left = 0%x
lblProfilo.Width = panelProfilo.Width
lblProfilo.Height = panelProfilo.Height


Put the label inside a (transparent) panel and set its elevation to 2dip or more.
So in the end this did work. Thank you very much.
 
Upvote 0
Top