Android Question GUI object wrong depth order

Devv

Active Member
Licensed User
Longtime User
I am facing a strange problem that i never faced before

the objects depth order is appearing in the visual designer in one way
and after compilation it apperas in another way

i have 8 buttons that are working perfectly
when i try to put anything above then (anything except another button) it will appear behind it
not matter what it is, i tried label and progress bar

in this screenshot you can see that label1 is a the top then comes button1 then the 8 buttons

Untitled.png


but after compiling the app and running it in my phone it appears label1 --> 8 buttons --> Button1
"label1 is that black small rectangle below button1"


phone.png



i cant in anyway make any label above these buttons which is very strange


any ideas are appreciated
 

techknight

Well-Known Member
Licensed User
Longtime User
Are you setting the Elevation in the designer? That always works for me. You can even set it programatically if you wish.
 
Upvote 0

Devv

Active Member
Licensed User
Longtime User
Are you setting the Elevation in the designer? That always works for me. You can even set it programatically if you wish.


my friend what do you mean by Elevation i never saw it in the designer

please clarify
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
Maybe that will solve the problem
But I don't want to use a panel
Why would I need a panel to but a label on a button
Because button has by default an elevation greater than a panel. You can also change manually the elevation of label by using reflection or java object, but putting it in a panel is simpler
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
or u use a imageview (instead of a button) it have also a click event. seems a label can be above a image :)
 
Upvote 0

Devv

Active Member
Licensed User
Longtime User
or u use a imageview (instead of a button) it have also a click event. seems a label can be above a image :)
Yes imageview seems to be the easiest way
but it does not support while pressed color or image
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
or u make a gap between the buttons where the label should appear.
your label is a description of the image in the buton?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Visual Designer works in Windows. Android has own mind about Z-order.

About all buttons. No reason to add labels. Buttons support text and icon. For example,

B4X:
    ' Set image as background
    Dim bkg As BitmapDrawable
    bkg.Initialize (LoadBitmap(File.DirAssets, "1.jpg"))
    Button1.Background = bkg

    ' Set text
    Button1.Text = "Some text"
    Button1.Gravity = Bit.Or (Gravity.BOTTOM, Gravity.CENTER_HORIZONTAL)
    ...

About "central button". Unlike elevation helps, it seems to me to use popup windows is more elegant way.
I posted some days ago a library and a sample
https://www.b4x.com/android/forum/t...pper-for-popupwindow-class.97879/#post-616872

Initialize function expects panel, you can place a button over it.
 
Upvote 0
Top