RemoteView在什么地方使用

RemoteView的使用

  • RemoteView概述

    • 到目前为止,RemoteView会用在两个地方:一个是在AppWidget,另外一个是在Notification.`先从官方对他的定义来看:
      RemoteView–
      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.

    • RemoteView描述一个view,而这个view是在另外一个进程显示的。它inflate于layout资源文件。并且提供了可以修改过view内容的一些简单基础的操作。 从这个定义我们就知道RemoteView是用来描述一个垮进程显示的view。从而你就会明白为什么AppWidget和Nofication需要用到它了。

  • AppWidget—RemoteView
    • 我们都知道AppWidgetProvider是一个BrocaseReceiver,只是接受到Enable, Update,disale,delete这些message,而真正显示界面的是AppWidgetHostView(这是在Launcher里面实现的)这中间就是通过RemoteView来沟通。通过RemoteView告诉Launcher你想要的AppWidget是长什么样。
  • Notification–RemoteView
    • 若你想自定义你的Notification也必须通过RemoteView.因为你定义的Nofication和显示Notification也是两个不同的进程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值