BUG - Activity.AddMenuItem2

Cableguy

Expert
Licensed User
Longtime User
I've used this before in V1.50 with no problems, but in v1.60 seems to not be working...

B4X:
Activity.AddMenuItem2("Setup","Setup")',LoadBitmap(File.DirAssets,"setup.png"))

Only shows the bitmap, without the "Setup" title!
 

henry1311

Member
Licensed User
Longtime User
I've used this before in V1.50 with no problems, but in v1.60 seems to not be working...

B4X:
Activity.AddMenuItem2("Setup","Setup")',LoadBitmap(File.DirAssets,"setup.png"))

Only shows the bitmap, without the "Setup" title!

the syntax is :
Activity.AddMenuItem2("Setup","Setup", LoadBitmap(File.DirAssets,"setup.png"))
Ciao
enrico
 

Cableguy

Expert
Licensed User
Longtime User
The code I posted suffers of a copy/paste disease.it was on of my experiments to see what. I was doing wrong.the bug exists,try it yourself.
 

Cableguy

Expert
Licensed User
Longtime User
Android doesn't show the text if the image is too large. Try setting a small icon and the text will appear.

In fact the image seems a bit large, althought it's taken from the SDK image sets, wich mean, it the same as the Android system uses! Then why this diference in sizes? Btw, what would be the "perfect" sizing for a menuitem image?
 

Cableguy

Expert
Licensed User
Longtime User
Btw, what would be the "perfect" sizing for a menuitem image?

According to the documentation on Android forums, the icon size is density dependant...so developers have to/should provide image sets for low, med and high density screens (1.0, 1.5 and 2.0)...
Since B4A is density aware, will a med density set suffice? Will the images be resized to density?

Values are as follows:
Low 36x36
Med 48x48
Hi 72x72
 

Cableguy

Expert
Licensed User
Longtime User
I believe that the size should be 36x36. The image will be scaled automatically.

At the moment I am using the 48x48 icon size and it seems to be the same size as used by other apps...I'll stick with it for the time being...But I believe this "issue" should be adressed in the AddMenuItem2 topic.
 

fabio_linate_milano

Member
Licensed User
Longtime User
Hi everyone

similar problem
Just a new source (I save of course)
I add a file in the tab files section (file name is info.png and it is 48x48)
I add the following line

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")

Activity.AddMenuItem2("info", "info", LoadBitmap(File.DirAssets, "info.png"))

End Sub

the icon does NOT appear.
Any idea, help, ...

thank you very much

best regard
fabio milano
 
Top