So I should set it to true even when my app doesn't include resources to accommodate any screen density (suppose I'm lazy so I don't create any size- or density specific resources)?
I'm wondering this because taken from: http://developer.android.com/guide/topics/manifest/supports-screens-element.html it says that if you set "anyDensity" to true it means "the application includes resources to accommodate any screen density". But I'm not including any of these explicitly, so what happens then scaling wise when anyDensity="true"? On 5 apr, 23:09, Dianne Hackborn <[email protected]> wrote: > Always set it to true... or better, just make android:targetSdkVersion >= > 4. Having it false is only for compatibility with old apps that were > written before there was a concept of density in the APIs. Using this > compatibility mode can cause some undesirable artifacts such as text metrics > being slightly inconsistent with actual rendering. > > > > > > > > > > On Tue, Apr 5, 2011 at 1:42 PM, MarcoAndroid <[email protected]> wrote: > > Hello there, > > > I've read > >http://developer.android.com/guide/practices/screens_support.html > > and > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > and > > >http://groups.google.com/group/android-developers/browse_frm/thread/5... > > and more related sources. > > > Still, what and when to set android:anyDensity to I find hard to > > figure out. > > > So, are these conclusions correct: > > > 1- android:anyDensity has been introduced really only for "older" apps > > (1.6 level 4 or lower) because those were most likely built with > > hardcoded density-dependent values like 'px'? And apps with level > > before 4 even don't understand density dependent resource directories > > like res/drawable-hdpi? > > By setting android:anyDensity="false", Android tries to scale those > > resources that use px values and in 'res/drawable' to match the > > device's real screen density. > > From level 5 onwards it is a well-known best-practice to always use dp > > and sp and density dependend resource directories, so usually apps > > take care themselves of being independent using those. And thus > > normally for those apps android:anyDensity="true" is sufficient (no > > auto-density-scaling). > > > 2- If android:anyDensity="false" are these density dependend resource > > directories plainly ignored as mentioned in this thread? > > >http://groups.google.com/group/android-developers/browse_frm/thread/5... > > But: how does the android:anyDensity="true" or "false" relate to > > resources that you might have put in res/drawable-mdpi and res/ > > drawable-hdpi etc? Does that setting then only have effect for those > > density resources you didn't specify in any configuration specific > > density-directory, and how? > > > 3- And what if I'm lazy and for any app I make I don't want to create > > density specific resources (like images), so only have the 'res/ > > drawable' dir, but do use dp and sp everywhere... What should > > android:anyDensity be set to then? My guess is "false" so Android will > > alwyas scale my resources from 'drawable'... > > > Regards, > > Marco > > > -- > > 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 > > -- > 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

