App Widgets 1

App Widgets are miniature application viewsthat can be embedded in other applications (such as the Home screen) andreceive periodic updates. These views are referred to as Widgets in the userinterface, and you can publish one with an App Widget provider.An application component that is able to hold other App Widgets is called anApp Widget host. The screenshot below shows the Music App Widget.

App Widgets 即应用程序小部件,可以理解为嵌在其他的应用程序(比如常见的桌面上的)中的,可以按一定频率更新的小型的应用程序视图。比如,可以加载到桌面上的天气预报,clock,新浪微博。。App Widgets可以利用App Widget provider来发布。

 

To create an App Widget, you need the following:

AppWidgetProviderInfo object

Describesthe metadata for an App Widget, such as the App Widget's layout, updatefrequency, and the AppWidgetProvider class. This should be defined in XML.

AppWidgetProvider class implementation

Definesthe basic methods that allow you to programmatically interface with the AppWidget, based on broadcast events. Through it, you will receive broadcasts whenthe App Widget is updated, enabled, disabled and deleted.

View layout

Definesthe initial layout for the App Widget, defined in XML.

Additionally, you can implement an App Widget configurationActivity. This is an optional Activity that launches when the user adds your App Widget and allowshim or her to modify App Widget settings at create-time.

The following sections describe how to setup each of thesecomponents.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值