As suggested, you have no other way but to implement onAppWidgetOptionsChanged in your widget provider - API level <Unfortunately, 16 users will not have this function.
To hide the buttons when reducing the widget, your widget should behave similarly to the weather widget, shown as an example on the Android Design website, according to the " Widgets " template (in fact, the application). You show fewer buttons when the widget is compressed, the number of buttons increases as you increase, setting the visibility of the buttons.

In onAppWidgetOptionsChanged , using the values ββspecified by the newOptions Bundle package, you must determine the change in width and height and set the dimensional buckets as indicated in the documents (from the same design page):
In fact, when the user resizes the widget, the system will respond with dp in which your widget can redraw itself. Planning a strategy for resizing a widget by "dimension buckets" rather than a variable grid size will give you the most reliable results.
What is really difficult is to identify these buckets. The newOptions package has the values ββmin_width, min_height, max_width and max_height, which differ significantly between devices, screen density, launchers, etc. Unfortunately, the Android team did not show us how to do this, and there are several onAppWidgetOptionsChanged code onAppWidgetOptionsChanged on the web, most of them are very simple.
source share