Re: [android-developers] Inflate layouts with different density
On Fri, Oct 22, 2010 at 1:27 PM, Brad Gies wrote: > Sorry if I'm hijacking this thread. > > How do you know (in Java) which of the three densities Android has chosen. > Is there a setting in the layout or somewhere that can be checked? See the DisplayMetrics class for the absolute and logical density values. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- 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
Re: [android-developers] Inflate layouts with different density
Sorry if I'm hijacking this thread. How do you know (in Java) which of the three densities Android has chosen. Is there a setting in the layout or somewhere that can be checked? Sincerely, Brad Gies --- Bistro Bot - Bistro Blurb http://bgies.comhttp://nocrappyapps.com http://bistroblurb.com http://forcethetruth.com http://ihottonight.com --- Everything in moderation, including abstinence (paraphrased) Every person is born with a brain... Those who use it well are the successful happy ones - Brad Gies Adversity can make or break you... It's your choice... Choose wisely - Brad Gies Never doubt that a small group of thoughtful, committed people can change the world. Indeed. It is the only thing that ever has - Margaret Mead On 21/10/2010 4:41 PM, Daniel Drozdzewski wrote: On Thu, Oct 21, 2010 at 11:58 PM, Weeds wrote: I'm wondering if it is possible to inflate a layout using a different density value than the default system density. I have a high density layout, which looks good on the Galaxy Tab (1024x600px, hdpi) and I like to use the same layout on another tablet with the same pixel resolution but medium density. The mdpi layout which is used works on the device but the screen just looks really empty and I would prefer to scale things up. So is there a xml argument for scaling the layout, maybe something similar to Bitmap.Options.targetDensity. Or could this be done with a new LayoutInflater class? Thanks Weeds, You cannot scale layout. I am not even sure what would that mean? Layout is resolution independent anyway. I think that you would you like for your UI elements to occupy bigger or smaller proportion of the screen, As you know, Android 'knows' the density of the platform it sits on and this gets classified into 1 of 3 brackets. Since your 2nd tablet has medium screen density, all you have to do, is to provide a mdpi layout that reflects your desired UI sizes and proportions. In other words, simply go and modify your current mdpi layout to make it 'less empty'. And don't forget that images used in your layouts have to be scaled as well in order to achieve the best results. -- Daniel -- 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 -- 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
Re: [android-developers] Inflate layouts with different density
On Thu, Oct 21, 2010 at 11:58 PM, Weeds wrote: > I'm wondering if it is possible to inflate a layout using a different > density value than the default system density. > > I have a high density layout, which looks good on the Galaxy Tab > (1024x600px, hdpi) and I like to use the same layout on another tablet > with the same pixel resolution but medium density. The mdpi layout > which is used works on the device but the screen just looks really > empty and I would prefer to scale things up. > > So is there a xml argument for scaling the layout, maybe something > similar to Bitmap.Options.targetDensity. > Or could this be done with a new LayoutInflater class? > > Thanks Weeds, You cannot scale layout. I am not even sure what would that mean? Layout is resolution independent anyway. I think that you would you like for your UI elements to occupy bigger or smaller proportion of the screen, As you know, Android 'knows' the density of the platform it sits on and this gets classified into 1 of 3 brackets. Since your 2nd tablet has medium screen density, all you have to do, is to provide a mdpi layout that reflects your desired UI sizes and proportions. In other words, simply go and modify your current mdpi layout to make it 'less empty'. And don't forget that images used in your layouts have to be scaled as well in order to achieve the best results. -- Daniel > > -- > 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 -- Daniel Drozdzewski -- 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