Android Question Different icon size with AddMenuItem3

Silli

Member
Licensed User
Longtime User
I use AddMenuItem3 with png files and a image size of 64 pixels. Thats look really good on my devices, but on a "HTC One S" the icons are to big (see attachments) Only when I use a image size of 32 pixels agrees the size, but they are blurred. Has anyone a idea?

Tested with the StdActionBar Example: http://www.b4x.com/android/forum/threads/stdactionbar-another-actionbar-library.36786/

B4X:
Activity.AddMenuItem3("MenuItem", "mi", LoadBitmap(File.DirAssets, "ic_action_edit.png"), True)


Nexus 4
IMG-20140120-WA0003.jpg

HTC One S
IMG-20140120-WA0005.jpg
 

Silli

Member
Licensed User
Longtime User
Hi Erel, thanks for your answer.

But when i use icons with 32px, than the buttons are blurred!

The guidelines say 32x32 dp, and not px for the icons.
1dp = 1px on a 160dpi screen. The HTC One S has a 240dpi screen. Or not?
 
Upvote 0

Silli

Member
Licensed User
Longtime User
Thats the icons of the Action Bar Icon Pack :)
http://developer.android.com/design...ffer&utm_medium=appdotnet&utm_campaign=Buffer

But, i have an idea! I will test the bitmap load with LoadBitmapSample

B4X:
Dim width As Int
Dim pscale As Float
pscale = GetDeviceLayoutValues.Scale
width = 32 * pscale

Activity.AddMenuItem3("MenuItem", "mi", LoadBitmapSample(File.DirAssets, "ic_action_edit_64.png", width, width), True)
 

Attachments

  • ic_action_edit_32.png
    ic_action_edit_32.png
    587 bytes · Views: 259
  • ic_action_edit_64.png
    ic_action_edit_64.png
    1.2 KB · Views: 261
Upvote 0

Silli

Member
Licensed User
Longtime User
Nothing has changed. :(

The left menu button is 64px with
Activity.AddMenuItem3("MenuItem", "mi", LoadBitmapSample(File.DirAssets, "ic_action_edit_64.png", width, width), True)

and the other is 32px with

Activity.AddMenuItem3("MenuItem", "mi", LoadBitmap(File.DirAssets, "ic_action_edit_32.png"), True)
 

Attachments

  • IMG-20140203-WA0012.jpg
    IMG-20140203-WA0012.jpg
    22.6 KB · Views: 303
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top