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

> The problem arises when you now get a device which still reports
> itself as HDPI, but has a much larger screen size, which is what the
> Samsung does - it reports itself as hdpi, but has 1024x600 pixels.
> What happens is your button is still 80DPI, and shows the same size as
> before, but the screen is now up to 2 times bigger in the X direction!
> Leaving either a ton of unusable space, OR still making your layout
> look small on a large screen. The problem is since android doesn't
> scale your app to fit the screen size, there is no way you can come up
> with a layout that will look "proper" on different screens. It may be
> "functional" but you wont be able to predict at all what the layout
> will actually LOOK like.
>

If you just want to have, say, a UI with 3x3 controls that are spread across
the available space, then tell the layout manager to this either with
weights in a linear layout or percentage units or such.  If you are using
ImageView for example for the inner controls, you can tell it how to adjust
the image to match whatever space it gets (scale it etc).


> I may still just not "get" this but right now it really seems
> convoluted to me. In my opinion what should have been a simple scaling
> is now a complex affair.
>

The behavior you are asking for is actually not what most apps want.  For
example, if I have a button in my app, I don't want its graphics to be
scaled up some fairly random amount so that whatever screen size I designed
my UI for is spread across the screen of whatever device I am running on.
 Most apps want their controls like buttons to stay the same size, and for
their UI to resize as they specify to give the extra space to a list view or
some other element of the UI that can show more data.

Or games would typically use a SurfaceView, and if they want to design their
game to assume a fixed size and let the platform resize to the real screen
size, that can be done by setting a fixed size for the surface view.  (At
the cost of potentially some jaggies or other artifacts since the entire
game in the surface view is being scaled before compositing to the screen.)

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