On Mon, Oct 24, 2011 at 6:44 AM, Mark Murphy <mmur...@commonsware.com>wrote:

> On Sun, Oct 23, 2011 at 6:04 PM, Ash McConnell <ash.mcconn...@gmail.com>
> wrote:
> > They must not provide the same amount of space (even if you consider
> device
> > independent pixels) as all units use dp.
>
> There is no such concept as "the same amount of space". You have no
> guarantee over the dp size of an app widget. Your dp values are
> converted into cells; different home screens on different devices will
> have different dp sizes for these cells. And, if you support the
> Honeycomb/ICS resizeable app widget, the user can change the size to
> whatever they want.
>
> Your app widget layouts need to take into account modest changes in
> the number of available dp for width and height, or more-than-modest
> changes if you're letting the user resize the widget.
>
>
Thanks Mark, that has made things a lot more clear.  I would like to deal
with the most typical scenario where the user will use the "normal" 4x2
allocation (in my case).  If I can get the height in DP I can use
removeViews and addView to swap in a layout with smaller font size and less
margin (if the height in dp is below a certain limit).  I'd like to have
the text as big as possible within the constraints, I could always have the
smaller size with less margin, but where's the fun in that :)


Is there a way to reliably get the height/width?  From searching on
StackOverflow it seems to be difficult with a widget with the only
suggestion being wait for x ms and then measure, which seems a little hacky.

Thanks for your help
All the best,
Ash

-- 
Awesome Widgets <http://www.siroccosoftware.com/awesome>
Online Racing Championship <http://onlineracingchampionship.com>
Twitter <http://twitter.com/AshMcConnell>

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