Thanks you could help me a lot! On júl. 21, 21:16, Dianne Hackborn <[email protected]> wrote: > On Thu, Jul 21, 2011 at 7:43 AM, Zwiebel <[email protected]> wrote: > > I have a program what looks like good on my HVGA emulator, everything > > is fine with it (however I don't know why it is use the hdpi drawable, > > when I have layout-normal-mdpi file too, with drawable-layout-mdpi > > file too.), > > layout-normal-mdpi is really wrong. drawable-layout-mdpi shouldn't even > compile. > > First. > > *Always* have a default resource. So you should have a layout/foo.xml file. > This is the basic layout of your app. The one that will be used if nothing > else matches the device. > > Second. > > Layouts care about screen size, drawables care about screen density. If you > have a resource that selects both a screen size and density (-normal-mdpi) > there is a 99.9% chance this is not what you want. > > So if you want to have an alternative layout for tablet screens, in addition > to your layout/foo.xml, you would have a layout-xlarge/foo.xml. > > Third. > > Densities are for bitmaps. They are used to select between different > alternative bitmaps that are available. The platform assumes that if it > doesn't have a matching resource for a particular density, it can pick > another and it will be scaled appropriately. If what you are selecting is > not a bitmap then it can't actually be scaled and you can end up with > resources being used that you don't want. > > So if you want to have two different bitmaps one for mdpi and one for hdpi > screens, they would be drawable-mdpi/icon.png and drawable-hdpi/icon.png. > > Note also that densities are the one exception to our rule "always have a > default resource" -- because we assume we can scale densities, some density > will always match no matter what the screen is, so they can all serve as > defaults. > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them.
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

