Well, this whole thing is part of work I have to do to fix up my widgets. I have a widget that lists a number of items. On HDPI, I can fit 5 items, while on MDPI, only 4. I thought that I'd put the number of rows as an "integer" resource. Since I don't know what the correct values should be for XHDPI / LDPI (I suspect 3 and 6), I wanted to just put 5 in the base value folder as a fallback for everything. (I had to do the same with specific layouts, but that's not important).
Needless to say, my plan didn't work, so to fix it, I had to put 5 into the values-hdpi folder as well as in the base value folder. On Dec 30, 3:47 pm, Dianne Hackborn <[email protected]> wrote: > Resource selection is generic, not tied to the resource type. This > selection makes sense for drawables, so it is correct. > > As a general rule for density configurations, I strongly recommend not > mixing specific densities with generic values. Since all densities are a > potential match, as you see here it can lead to results you don't want. > > Also doing what you are doing is unusual, to say the least. Generally one > would do this as a dimension resource, so it can be expressed as "10dp" or > whatever and thus automatically scaled for the density. (In that case you > would just have one generic value, not specifying different values for > different densities.) > > > > > > On Wed, Dec 29, 2010 at 8:39 PM, Zsolt Vasvari <[email protected]> wrote: > > I have an integer resource defined. Placed the default value into > > values/integers.xml and an MDPI override in values-mdpi/integers.xml > > > On my HDPI device, the resource that's picked comes from the MDPI > > folder and not the default folder. I consider this a bug. I can see > > it being correct for drawables, as you would want to scale from the > > closest match, but for anything else, I believe this should absolutely > > not be the case. > > > PS: I tried to test what would happen on an LDPI screen, but I am no > > longer able to start a QVGA emulator session. The emulator, running > > either 2.2 and 2.3 just hangs after the text "A N D R O I D" boot > > screen. > > > -- > > 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]<android-developers%2bunsubs[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > 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.- Hide quoted text - > > - Show quoted text - -- 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

