Technical Bits
Screen Sizes for Foursquare Stats Widget
There’s a layer of complexity in supporting multiple screen resolutions when using pre-scaled Drawable resources. It gets even harder when you consider both Portrait and Landscape since the pixel density swaps around.
I created 3 widgets, each with background a resource:
- tiny
- small
- medium
(Jeff Sharkey my inspiration for the naming conventions).
There are 3 categories of pixel density which could be supported:
- low
- medium
- high
That means 9 Drawable resources. Now consider the two layout possibilities: Portrait and Landscape. That’s 27 Drawable resources, each pre-scaled to a different width-by-height pixel density.
At this point I don’t have it working perfectly. For some of the above combinations, the Drawable resources are pixel perfect but for others, say Landscape at high DPI, some look squashed. I’ll also need to revisit how I placed the TextViews (using padding/layout_margins and dips at the moment) which are sometimes out of alignment.
Is there a better approach? Should I have broken the Drawable resources into pieces and placed them as the background resources for each TextView? Urrrgh, hope not.




1 year ago
