B4A Library [B4X] [XUI] HexMenu

Status
Not open for further replies.
Cross platform hexagons menu implemented as a custom view:

pQtXvSJZQ0.gif


Can show up to 7 items.

B4A project is attached. Class is supported by B4J and B4i as well. Depends on XUI and BitmapCreator libraries.

Example with gradient stroke:

i_view64_Ihv7fjyBRn.png

Version with gradient stroke: https://www.b4x.com/android/forum/threads/b4x-xui-hexmenu.112410/#post-700941
 

Attachments

  • HexMenu.zip
    11 KB · Views: 503
Last edited:

LucaMs

Expert
Licensed User
Can show up to 7 items.
Note that in your project you "try" to add 10 items (For i = 1 To 10) :)

I think that they should be always 7 (or 19), to look nice.
upload_2019-12-22_21-23-44.png


Now it is needed to add images inside the hexagons; who will do it? :D
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Note that in your project you "try" to add 10 items (For i = 1 To 10)
True. I added more items as a test. It ignores the 8th and above items.

Now it is needed to add images inside the hexagons; who will do it?
Shouldn't be too difficult to do. There are several ways to add images. If the images are small so you don't need to deal with clipping then the simplest way is to add ImageViews in the same way that the labels are added.

It is also not too complicated to deal with clipping. It can be done by drawing with bc.DrawPath2 and a BCBrush that is based on a BitmapCreator.
 

LucaMs

Expert
Licensed User
Shouldn't be too difficult to do. There are several ways to add images. If the images are small so you don't need to deal with clipping then the simplest way is to add ImageViews in the same way that the labels are added.
Hexagon.png



As you know, I'm lazy :D, so I used a single image and I didn't manage the labels (superimpose them on the ImageViews or set a LabelsOnly property, for example).
 

Attachments

  • HexMenu2.zip
    16 KB · Views: 188

LucaMs

Expert
Licensed User
As you know, I'm lazy :D, so I used a single image and I didn't manage the labels (superimpose them on the ImageViews or set a LabelsOnly property, for example).
I rested sufficiently :)

Now you can choose the "menu item type": image, text or both (it's a property).
 

Attachments

  • HexMenu2_1.zip
    16.4 KB · Views: 230

ThePuiu

Active Member
Licensed User
It is possible to add to the text and an image (FontAwesome)? Something like the attached image
 

Attachments

  • but.png
    but.png
    25.2 KB · Views: 122

LucaMs

Expert
Licensed User
It is possible to add to the text and an image (FontAwesome)? Something like the attached image
The list of labels is public. You can write what and how you want ;)

In version 2.1 I changed the labels' text color (project code).
 

LucaMs

Expert
Licensed User
Now I shoud mix your last example (gradient), also adding properties for the 2 colors, with my version (images)!

Mi piacerebbe ma non mi va :D (italian)
 

ThePuiu

Active Member
Licensed User
Thanks Erel! In B4I a number appears instead of the icon.
 

Attachments

  • IMG_2314.PNG
    IMG_2314.PNG
    196.9 KB · Views: 156

LucaMs

Expert
Licensed User
Now I shoud mix your last example (gradient), also adding properties for the 2 colors, with my version (images)!

Done.
Added also a property for the stroke gradient orientation.

upload_2019-12-23_19-14-47.png
 

Attachments

  • HexMenu2_21.zip
    16.7 KB · Views: 227
Last edited:

amidgeha

Active Member
Licensed User
I have one of the hexmenu buttons that opens a browser using
B4X:
StartActivity(xph.OpenBrowser("http://mechanicalpowergen.com"))
when I press back the button text disappears when I press any other button in hexmenu.
 
Last edited:

amidgeha

Active Member
Licensed User
Cross platform hexagons menu implemented as a custom view:

pQtXvSJZQ0.gif


Can show up to 7 items.

B4A project is attached. Class is supported by B4J and B4i as well. Depends on XUI and BitmapCreator libraries.

Example with gradient stroke:

i_view64_Ihv7fjyBRn.png

Version with gradient stroke: https://www.b4x.com/android/forum/threads/b4x-xui-hexmenu.112410/#post-700941
I have one of the hexmenu buttons that opens a browser using
B4X:
StartActivity(xph.OpenBrowser("http://mechanicalpowergen.com"))
when I press back the button text disappears when I press any other button in hexmenu.
 
Status
Not open for further replies.
Top