On Sun, Jul 4, 2010 at 7:31 AM, Tom Gibara <m...@tomgibara.com> wrote: > This is what I'm not clear on: suppose you have a UI design that calls for > an ImageButton that fills approximately half the screen. The geometry is > easily defined by combining layout_weight and fill_parent etc. The image > displayed in the ImageButton will cover approximately the same number of > pixels on say both the Dell Streak and the Nexus One. So how do we organize > our resources such that both of these phones will choose the same image > resource for the button, while at the same providing a smaller image for > devices such as the G1 (ie. a device that has far fewer pixels, but the > roughly same screen size as the Nexus One)?
To get more concrete, and to roll this discussion back to Mr. Lebed's original questions, let's suppose you have one square icon, 250 pixels to a side, that you want to use on WVGA screens, and another square icon, 100 pixels to a side, you would like to use on HVGA screens. And, these logically are the same icon, so you want your layouts and Java code and whatever to refer to them as the same name. If so, by eyeball (i.e., haven't slung the code for this specific scenario), the following should work: Step #1: Put the 250px icon in res/drawable/ as icon_250px.png Step #2: Put the 100px icon in res/drawable/ as icon.png Step #3: Put a resource alias in res/drawable-large-mdpi/ as icon.xml, pointing to icon_250px.png (note to Mr. Lebed: one of your earlier problems was having your -mdpi and -large suffixes reversed -- they need to be in the order seen in Table #2 in the URL shown below) http://developer.android.com/guide/topics/resources/providing-resources.html Step #4: Put a resource alias in res/drawable-normal-hdpi/ as icon.xml, pointing to icon_250px.png >From the standpoint of resolving resources, when Android encounters the @drawable/icon reference: -- A Dell Streak (a large, mdpi device) will choose the res/drawable-large-mdpi/ resource, which will reference the 250px image -- A Nexus One (a normal, hdpi device) will choose the res/drawable-normal-hdpi/ resource, which will reference the 250px image -- Devices that are not large/mdpi or normal/hdpi, like the G1, will choose the res/drawable/ resource, which is the 100px image -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Consulting: http://commonsware.com/consulting -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en