Unfortunately you cannot adjust width and height with a normal app. Only an AppWidgetHost can do that (i.e. a launcher): https://developer.android.com/guide/topics/appwidgets/host.html.
It's really very unfortunate that the Android team haven't improved the stock launcher lately - so most 3rd party devs doing launchers would follow their steps - this could be done easily providing an API to let normal apps ask the launcher to resize the widget. And that decision of keeping the same size when switching to landscape... sigh. Why they haven't exchanged width and height? For example, a 3x2 portrait widget should be automatically changed to a 2x3 landscape widget. Hope this helps, José https://play.google.com/store/apps/developer?id=Jos%C3%A9+Gonz%C3%A1lez+D%27Amico El domingo, 28 de diciembre de 2014 03:52:27 UTC-3, Vineet Shukla escribió: > > Hello, > > I am working over widget where I need to control the width and height of > widget programmatically when device rotates from portrait to landscape and > landscape to protrait. > For this when configuration change I call the below code to update the > widget width programmatically: > > for (int id : appWidgetIds){ > Bundle newOptions = appWidgetManager.getAppWidgetOptions(id); > int minWidth = > newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, 0); > newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, > minWidth - 100); > appWidgetManager.updateAppWidgetOptions(id, newOptions); > } > > After this, I get call onAppWidgetOptionsChanged() with new values but > widget don't get resized. > > However I am also calling onUpdate(). > > minSdkVersion is 16. > > I searched a lot but could not find related to this problem, thanks if > advance for your valuable time. > > Thanks > -- 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.

