I don't know exactly what is going on here, but I would *strongly* suggest
that if you are trying to do different layouts based on screen density then
you are doing things wrong.

The only thing density impacts is UI scaling; that is taken care of in a
layout with the "dp" units if you need to specify dimensions.  It otherwise
has no impact on layout, and should not cause your layout to change.

Note as per the spec for resource resolution, density configurations are
matched in a somewhat special way, since the platform assumes it can pick
any density resource and scale it to match the real device density.
 Obviously this doesn't make a lot of sense for layouts, so it is something
you should avoid.

On Tue, Sep 14, 2010 at 8:36 PM, niko20 <nikolatesl...@yahoo.com> wrote:

> I also tried to change my targetSdk value to "7" and it made no
> difference, without a root "layout" default layout.xml file, the app
> crashes - it doesn't load the layout-normal-hdpi layout.xml file for
> some reason.
>
> How frustrating this layout stuff is!
>
>
> -niko
>
>
> On Sep 14, 10:12 pm, niko20 <nikolatesl...@yahoo.com> wrote:
> > Just wanted to give a bit more info
> >
> > I also have a layout.xml file in the default "layout" directory.
> >
> > In my code the main activity uses this line:
> >
> > setContentView(R.layout.main);
> >
> > If I delete the layout.xml from the default layout directory I get a
> > force close on startup.
> >
> > So does this line of code interfere with android's layout loading or
> > something , overriding it?
> >
> > -niko
> >
> > On Sep 14, 9:40 pm, niko20 <nikolatesl...@yahoo.com> wrote:
> >
> > > Hi,
> >
> > > I'm trying to understand the layout engine for different screen sizes
> > > and densities, to look into adding support for tablets in my apps.
> >
> > > I was under the impression that you could also have different layouts
> > > based on screen density as well in android, and it would select the
> > > appropriate one.
> >
> > > I have the following:
> >
> > > a layout-normal-mdpi directory with a layout.xml file.
> > > a layout-normal-hdpi directory with a layout xml file with a different
> > > layout for high density screens.
> >
> > > In my application manifest I have min SDK as 3,  target SDK as 5. I
> > > have a supports-screens element and declare the following:
> >
> > > android:largeScreens="true" android:anyDensity="true"
> >
> > > I'm compiling against Android 2.2 library.
> >
> > > However, when I run an AVD that is in WVGA854 mode with a lcd.density
> > > of 240, android isn't using my hdpi layout, it still uses my mdpi
> > > layout. I don't know why and need help!
> >
> > > Thanks!
> >
> > > -niko
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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 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

Reply via email to