Android Question [XUI] AS Popup Menu Border

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone!
I'm using this awesome library made be @Alexander Stolte
However, I need to add a border to the menu like in the following image, but I do not know if it's possible.
I tried to add it to the .MenuPanel but it didn't work.
Screenshot 2025-06-01 alle 17.13.40.png

(Could also be my fault)

(P.S. I already styled everything else, I only need to understand how to add the border)

Thanks in advance
 

Alexander Stolte

Expert
Licensed User
Longtime User
You have 2 options.

Option 1:
Make divider visible
B4X:
    aspm_main.DividerEnabled = True
    aspm_main.DividerHeight = 2dip
    aspm_main.DividerColor = xui.Color_ARGB(152,0,0,0)
1748851578225.png


Option 2:
Color every 2nd item
B4X:
    aspm_main.ItemLabelProperties.TextColor = xui.Color_Black
    
    For i = 0 To 4 -1
        
        If i Mod 2 = 0 Then
            aspm_main.ItemLabelProperties.ItemBackgroundColor = xui.Color_ARGB(255,233, 233, 233)
            Else
            aspm_main.ItemLabelProperties.ItemBackgroundColor = xui.Color_White
        End If
        

        aspm_main.AddMenuItem("Test_" & (i +1),"item_" & i)
    Next
1748851774318.png
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Oh sooo, I misunderstood, you want to change the corner radius...
Hi Alexander!
Nono, for the radius it is ok! it works already.

What I need is to add the border to the menu (I marked it red now to be more understable).
For this reason I tried popupMenu.MenuPanel.SetColorAndBorder(...) but it is readonly (and I think it can mess up with .MenuCornerRadius attribute).

Is there a way to do it?
Screenshot 2025-06-02 alle 11.03.07.png


(If it is not possible I will try to modify by myself. If I succeed I will post the updated library)
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
If it is not possible I will try to modify by myself
unfortunately you can't change the border color, it has no effect, probably because the child items cover it up.

i just don't know why, but you can't see the border color, i had already added 2 new eproperties this morning, but no effect.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
i just don't know why, but you can't see the border color, i had already added 2 new eproperties this morning, but no effect.

I took a look to the library and I managed to obtain something... however I reached an Android limitation
If you have a rounded panel with setClipToOutilne it will mask out also the border...

To show the border I added two methods (setMenuBorderColor and setMenuBorderWidth) and then tweaked the OpenMenu method to add a padding to the elements inside the menu's panel (because they cover the border otherwise).

However, by looking on the internet, it seems that is solvable by using a panel just to draw the border, but I do not know if I want to mess up the library now 😂 ...

Thanks for your time Alexander ☺️, in case I edit the library you will know 👍🏼

IMG_5309.jpg


I attach the example project
 

Attachments

  • ASPopup Menu Border Example.zip
    18 KB · Views: 77
Upvote 0
Top