When widgets are dropped onto the home screen, they are given a reserved space to display custom content provided by your app. Users can also interact with your app through the widget, for example pausing or switching music tracks. If you have a background service, you can push widget updates on your own schedule, or the AppWidget framework provides an automatic update mechanism.
In the coming articles, I will show how to create Home Screen Widgets step-by-step.
Notes:
- Starting in Android 3.1, developers can make their homescreen widgets resizeable — horizontally, vertically, or on both axes. Users touch-hold a widget to show its resize handles, then drag the horizontal and/or vertical handles to change the size on the layout grid.
- Starting from Android 4.0, home screen widgets should no longer include their own padding. Instead, the system now automatically adds padding for each widget, based the characteristics of the current screen. This leads to a more uniform, consistent presentation of widgets in a grid.
Step-by-step to create Home Screen Widget:
- Define app widget provider in XML
- Define widget layout
- Implement our dummy AppWidgetProvider
- Define Widget Provider Receiver in AndroidManifest.xml
- Modify our AppWidgetProvider to update widget RemoteViews
- Implement configure activity
- Resizeable home screen widget
- Custom background shape of Widget
- Implement OnClick PendingIntent for Widget
0 Response to "Home Screen Widgets"
Posting Komentar