This foliate provides an initiation to the different types of widgets you might want to create and some design principles to follow. To start building an app appliance, read Create a bare appliance .
- 1 Widget types
- 2 Integrate widgets with Google Assistant
- 3 Widget limitations
- 4 Design guidelines
- 5 Widget design checklist
As you begin planning your appliance, think about what kind of appliance you ‘re trying to build. Widgets typically fall into one of the following categories :
Figure 1: An information widget from a weather app
Information widgets typically display a few all-important information elements and track how that information changes over clock time. good examples for information widgets are weather widgets, clock widgets or sports score tracking widgets. Touching information widgets typically launches the consociate app and opens a detail horizon of the appliance information.
Reading: App widgets overview | Flickroom
Collection widgets specialize in displaying multiple elements of the same type, such as a solicitation of pictures from a drift app, a solicitation of articles from a news app or a collection of emails/messages from a communication app. Collection widgets can scroll vertically .
Collection widgets typically focus on the following use cases :
- Browsing the collection
- Opening an element of the collection to its detail view in the associated app
- Interacting with elements such as marking them done (with new support for
compound buttons in Android 12 (API level 31))
Figure 4: Example of a control widget
The chief purpose of a control appliance is to display often-used functions, so that the drug user can trigger right from the home screen without having to open the app beginning. You can think of them as distant controls for an app. An example of a see appliance is a home dominance widget that lets users turn lights on or off in different rooms of a house .
Interacting with a control appliance may or may not open an consort detail view in the app. This depends on whether the control appliance ‘s function outputs any data, such as in the lawsuit of a search doodad .
Figure 5: Example of a music app
While some widgets tend to gravitate towards one of the types in the precede sections ( information, collection, or control condition ), many widgets in reality are hybrids that combining elements of different types .
A music actor appliance is chiefly a control doodad, but besides keeps the user informed about what track is presently playing. It basically combines a operate doodad with elements of an data doodad type. When planning your appliance, design around one of the floor types and add elements of other types if needed .
Integrate widgets with Google Assistant
Any of the preceding appliance types can be displayed by Google Assistant in reaction to user voice commands. You can configure your widgets to fulfill App Actions, enabling users to receive quick answers and interactional app experiences on Assistant surfaces like Android and Android Auto. For more details on appliance fulfillment for Assistant, see Integrate App Actions with Android widgets .
While widgets could be understood as “ mini apps, ” there are certain limitations that are important to understand before you embark on designing your appliance .
Because widgets live on the home screen, they have to co-exist with the navigation that is established there. This limits the gesture corroborate that is available in a doodad compared to a full-screen app. While apps, for exemplar, may allow users to navigate between screens horizontally, that gesticulate is already taken on the home screen for the determination of navigating between home screens .
The only gestures available for widgets are touch and vertical swipe .
Given the preceding limitations with interactions, some of the UI building blocks that rely on restrict gestures are not available for widgets. For a complete tilt of patronize construction blocks and more information on layout restrictions, see Create the appliance layout, Provide elastic appliance layouts .
Widgets are a great mechanism to attract a user to your app by “ advertise ” newly and interest contented that is available for consumption in your app .
equitable like the teasers on the front page of a newspaper, widgets should consolidate and concentrate an app ‘s information and then provide a connection to richer detail within the app ; or in early words : the doodad is the data “ bite ” while the app is the “ meal. ” As a buttocks line, always make certain that your app shows more detail about an information detail than what the appliance already displays.
Besides the saturated information contented, consider rounding out your widget’s offer by providing seafaring links to frequently used areas of your app. This lets users complete tasks quick and extends the functional range of the app to the home screen .
dependable candidates for navigation links to surface on widgets are :
- generative functions : These are the functions that allow the exploiter to create raw content for an app, such as creating a newly document or a modern message .
- open application at top flat : tap on an information chemical element will normally navigate the drug user to a lower level detail screen. Providing access to the top flat of your lotion provides more navigation tractability and can replace a dedicated app shortcut that users would differently use to navigate to the app from the home screen. Using your application icon as an affordance can besides provide your appliance with a authorize identity in case the data you ‘re displaying is ambiguous .
Figure 6: Standard Google Clock widget
Long-pressing on a resizable appliance, and subsequently releasing puts that widget into resize mode. Users can use the drag handles or the appliance corners to set the craved size .
Resizing allows users to adjust the stature and/or the width of a doodad within the constraints of the home riddle placement grid. You can decide if your appliance is freely resizable or if it is constrained to horizontal or vertical size changes. You do not have to support resizing if your especial doodad is inherently fixed-size .
Allowing users to resize widgets has important benefits :
- They can fine-tune how much information they want to see on each widget.
- They can better influence the layout of widgets and shortcuts on their home
Planning a resize strategy for your doodad depends on the type of appliance you’re creating. tilt or grid-based collection widgets are normally straightforward because resizing the doodad will plainly expand or condense the vertical scroll area. Regardless of the doodad ‘s size, the exploiter can still scroll all information elements into position. Information widgets, on the early hand, require a bit more hands-on plan since they are not scrollable and all contented has to fit within a given size. You will have to dynamically adjust your widget’s content and layout to the size the user defined through the resize mathematical process .
In this elementary example, the exploiter can resize a weather doodad in three steps, exposing richer information about the weather at the current placement as the doodad grows .
Figure 7: Example weather widget in a 3×2-grid ‘small’ size
Figure 8: Example weather widget in a 5×2-grid ‘medium’ size
Figure 9: Example weather widget in the 5×4-grid ‘large’ size
For each appliance size, determine how much of your app ‘s information should be surfaced. For smaller size, condense on the essential and then add more contextual information as the doodad grows horizontally and vertically.
It ‘s tempting to lay out your widgets according to the dimensions of the placement power system of a particular device that you own and develop with. This can be a useful initial approximation, but keep the pursue points in take care :
- Planning your widget resizing strategy across “size buckets” rather than
variable grid dimensions gives you the most reliable results.
- The number, size, and spacing of cells can vary widely from device to
device. Hence, it is very important that your widget is flexible and can
accommodate more or less space than anticipated.
- In fact, as the user resizes a widget, the system responds with a dp size
range in which your widget can redraw itself.
- Starting in Android 12, you can provide more refined size
attributes and more flexible layouts. This includes:
- Specifying widget size
constraints. For example,
you can specify the target size for your widget (in grid cells) as well
as the maximum possible size.
- Providing responsive layouts,
which change depending on the size of the widget.
- Providing exact size layouts,
which let the launcher respond with size options for portrait
and landscape mode for phones, or four sizes for foldables.
- Using updated guidance and new
APIs for determining proper sizes
for your widget.
- Specifying widget size
Widget configuration by users
sometimes, the drug user needs to set up the doodad before it can become utilitarian. Think of an e-mail doodad where the exploiter needs to select the mail booklet before the inbox can be displayed, or a static photograph doodad where the drug user has to assign a movie from the gallery to be displayed. Android widgets display their shape choices right after the exploiter drops the doodad onto a home blind .
Note: Android 12 adds newly options to let you provide a more seamless configuration know for users. See enable users to configure App Widgets for details on allowing users to reconfigure already placed widgets and skip the nonpayment shape pace .
Widget design checklist
- Focus on small portions of glanceable information on your widget. Expand on
the information in your app.
- Choose the right widget type for your purpose.
- Plan how the content for your widget should adapt to different sizes.
- Make your widget orientation and device independent by ensuring that the
layout is capable of stretching and contracting.
- Consider whether your widget needs any additional configuration.