你的位置:首页 > 软件开发 > 操作系统 > android 之 桌面的小控件AppWidget

android 之 桌面的小控件AppWidget

发布时间:2015-11-12 00:00:03
AppWidget是创建的桌面窗口小控件,在这个小控件上允许我们进行一些操作(这个视自己的需要而定)。作为菜鸟,我在这里将介绍一下AppWeight的简单使用。1.在介绍AppWidget之前,我们先来了解一下PendingIntent和RemoteViews;PendingIn ...

android 之 桌面的小控件AppWidget

AppWidget是创建的桌面窗口小控件,在这个小控件上允许我们进行一些操作(这个视自己的需要而定)。作为菜鸟,我在这里将介绍一下AppWeight的简单使用。

1.在介绍AppWidget之前,我们先来了解一下PendingIntent和RemoteViews;

PendingIntent:A description of an Intent and target action to perform with it. Instances of this class are created with getActivity, getActivities, getBroadcast, and getService; the returned object can be handed to other applications so that they can perform the action you described on your behalf at a later time.

翻译:通过PendingIntent来描述一个Intent和target action,这个类的实例和getActivity,getActivites,getBroadCast,getService一起创建:返回的对象能够传给其他程序,以便它们能在后来执行你想让他们执行的动作。

结合Mars老师的讲解可以这样来理解:PendingIntent能够包含一个Intent对象,能够将这个Intent传递给其他的应用,当满足一定条件时,就会执行这个Intent中包含的动作。getActivity和getActivities是为了启动活动,getBroadcast是为了发送广播,getService是为了开启一个服务。(这个在下面有讲解)

RemoteViews:A class that describes a view hierarchy that can be displayed in another process. The hierarchy is inflated from a layout resource file, and this class provides some basic operations for modifying the content of the inflated hierarchy.

翻译:remoteviews:一个类描述了一个视图的层次结构,可以显示在另一个进程。该层次结构从布局资源文件中增长,该类提供一些基本操作来修改虚化层次结构的内容。

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:android 之 桌面的小控件AppWidget

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录