Hi all,
What's the "correct" B4A/Android way to support multiple resolutions for toolbar icons?
So far in my apps, I've used this simplistic method to do toolbar icons:
- Get a 24dip icon from a site like materialdesignicons.com.
- Use a paint program to create a 48dip bitmap with the 24dip icon centered.
- Create a "pressed" version by adding a transparent grey background.
- Create the button in the B4A designer, and point the Enabled and Pressed drawable properties to the respective bitmap files.
That works (although it seems very manual for such a common task). However, I'd like to start doing it the "correct" way, which I assume is using multi-resolution resources (e.g. drawable-mdpi, drawable-hdpi, etc.).
Searching the B4A forums, I don't see any way to reference a resource from the designer, so the best bet seems to be to do it in code using the AndroidResources library. Is this the easiest way?
In a perfect world, I could add a button using the designer, choose an icon visually from a gallery, and it would handle the multi-res stuff and the various StateListDrawable states for me. That would definitely fit the idea of a RAD tool.
Cheers!