Search code examples
androidandroid-appwidgetandroid-appwidget-list

Change the height of the appWidget programmatically?


Could we change programmatically and dynamically the height of the appWidget at runtime depending to the displayed components of the listview.


Solution

  • No. The size of the app widget is managed by the user, with the assistance of the home screen, not you. You suggest sizing using the app widget metadata, but the actual sizing is out of your hands.

    After all:

    • Not all home screens allow app widgets to change size by any means, due to limitations in the home screen implementation

    • Your app widget may be adjacent to other things (e.g., other app widgets, shortcuts), where your app widget changing size would affect those other things

    • Just because you want the app widget to be bigger does not mean that the user wants the app widget to be bigger