Google's calculation for widget sizes only seems to work for 5X5 grid, how to adapt for other sizes?

21 Views Asked by At

According to the documentation here the calculation for a grid size should be 70 * n - 30, yet when creating my widget this only seems to apply to a 5x5 grid meaning that when the user has a 4x4 grid the widget will never reach its smallest state.

I understand that there is no way to determine the grid size on a phone/tablet and that the user can change this at any time, so how do other developers handle this?

Is there a workaround?

extra details:

  • This has been tested on a pixel 7
  • When using a 4x4 grid this formula seems to return 272dp ( 4 cells) while a 5x5 grid returns 213dp ( 3 cells) with the cut off being 250dp.
0

There are 0 best solutions below