I have followed the tutorials on developers.android.com and designed
my widget using the provided widget frame assets for a 2x2 horizontal
and portrait layout.  This frame asset was modified to create a 1x1
frame by following the recommendation of grabbing a screenshot and
aligning to the search widget.  Layouts are defined using only dp and
everything aligns properly on medium density screens.  I have read
over the documentation on supporting multiple screen-sizes many times
and I understand how to create layouts specific to each screen density
and/or size.

I know that I need to create new layouts for small and high density
screens, but from looking at the improper layouts, I do not understand
*what* I need to change in my existing layouts.  My general question
is, based on the screenshots below, what do I need to modify to make
alternate layouts with proper alignment?

To illustrate my confusion and thought process, here is the layout on
a medium density screen.
http://tinyurl.com/2dvruna

Here is what things look like on a small density screen.
http://tinyurl.com/2fey4lf

The alignment disparity is easy to see in the above image, the
Widget's may be the proper overall length and height, but the padding
on the borders is wrong.

So I thought "self, perhaps the background image dimensions are
causing an alignment issue due to scaling on different densities".
The obvious solution would be to create a custom layout asset like I
did for the 1x1 frame.  In response, I filled in the transparent areas
of the image to see where my borders were.  On a low density screen,
the borders were snuggly aligned to the edges of the search widget,
great, an easy fix in familiar territory .  But on a high-density
screen this isn't the case.
http://tinyurl.com/273yo2y

>From the above screenshot you can see that the far left of the widget
isn't even aligned with the left edge of the search widget, even with
transparent areas filled.  I do not understand where this extra
padding is coming from.  It seems that regardless of DPI, the origin
of the image (top left) should always be in the same location, is this
not true?  Why is this not true?

Still, the most confusing layout is on Android 2.2 at Medium density,
(which works fine on all other platform versions) where the Widget's
align like so, a site so embarrassing I almost didn't post it.  Again
I am unsure what would be causing this ugly overlap:
http://tinyurl.com/29bbcha

For reference, I am compiling against 1.6 with a minSdkVersion of 3.
My supports-screens tag has anyDensity=true (because I am using
density-independent units for all of my layouts):
<supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true" />

In my appwidget-provider, I am using the recommended formula of ( (74
* number of cells) - 2) to specify the minWidth/minHeight.  For my 2x2
widget this is 146dp x 146dp and the 1x1 widget is 72dp x 72dp.  The
actual widget layouts are using RelativeLayout where I specify the
layout_width/height in dp based on the dimensions/orientation given in
the Widget Design Guidelines.

Thank you for your consideration.

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

Reply via email to