salih suat kükrer
salih suat kükrer

Reputation: 161

Is it possible to obtain provided area for widgets by phone without widgetId in Android?

I am new to Glance library and want to learn provided are for widgets from phone before I place the widget in the home screen. Currently, when I put the widget home screen I check the provided area like this answer(https://stackoverflow.com/a/58501760/14221638) it is working without any problem however this is not what I want. My widgets are 2x2 is there any solution that I can learn it without giving widgetId?

Upvotes: 0

Views: 44

Answers (1)

Gdroid
Gdroid

Reputation: 86

In Glance, to provide content catered to the widget size, you can use the LocalSize.current composition local.

For instance, see this example that uses it to decide whether to show small or medium or a large view.

You may want to set size mode as Exact on your Glance app widget class.

Upvotes: 0

Related Questions