Sorry just to clarify a typo: The actual widget WIDTH in pixels corresponds exactly to OPTION_APPWIDGET_MIN_WIDTH * screen density. The actual widget HEIGHT in pixels corresponds exactly to OPTION_APPWIDGET_MAX_HEIGHT * screen density.
I really don't understand why the actual width would match the _MIN_WIDTH value, but the actual height would match the _MAX_HEIGHT value. That doesn't make any sense to me. The (OPTION_APPWIDGET_MIN_HEIGHT* screen density) value doesn't seem to relate to anything, it is far too small for the actual widget height, and the (OPTION_APPWIDGET_MAX_WIDTH* screen density) value is ridiculous, wider than the actual screen resolution. On Tuesday, December 30, 2014 12:28:27 AM UTC+8, Dusk Jockeys Android Apps wrote: > The docs refer to the following: > > onAppWidgetOptionsChanged() > > This is called when the widget is first placed and any time the widget is > resized. You can use this callback to show or hide content based on the > widget's size ranges. You get the size ranges by calling > getAppWidgetOptions(), which returns a Bundle that includes the following: > •OPTION_APPWIDGET_MIN_WIDTH—Contains the lower bound on the current width, > in dp units, of a widget instance. > •OPTION_APPWIDGET_MIN_HEIGHT—Contains the lower bound on the current > height, in dp units, of a widget instance. > •OPTION_APPWIDGET_MAX_WIDTH—Contains the upper bound on the current width, > in dp units, of a widget instance. > •OPTION_APPWIDGET_MAX_HEIGHT—Contains the upper bound on the current > width, in dp units, of a widget instance. > > Can anyone explain what these ranges actually mean, and why there is a > range at all, as opposed to the actual resized values. > > Because if I look at the values after a resize and compare it to the > screen area covered by the widget, the results seem very strange. > > The actual widget width in pixels corresponds > to OPTION_APPWIDGET_MIN_WIDTH * screen density. > The actual widget width in pixels corresponds to > OPTION_APPWIDGET_MAX_HEIGHT * screen density. > > Yep, you read that right, the MIN width, but the MAX height!? > > I want to work out the general size and aspect ratio of the resized widget > so I can adjust the layout, as recommended by the docs, but just getting > the widget size seems unnecessarily opaque. > > Does anyone know? > > Thanks > James > -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

