理解RemoteViews概念

来源:互联网 发布:mysql官网下载 编辑:程序博客网 时间:2024/06/16 08:15

1 RemoteViews提供了一组基础的操作用于跨进程更新它的界面
RemoteViews的作用是在 其他进程中显示并更新View的界面
RemoteViews主要用于通知栏和桌面小部件
通知栏和桌面小部件分别由NotifactionManager和AppWidgetManager管理
NotifactionManager和AppWidgetManager通过Binder分别和SystemServer进程中的NotifactionManagerService以及AppWidgetManagerService进行通信
即通知栏和桌面小部件的界面都运行在SystemServer进程中,无法直接更新View,只有借助RemoteViews来进行界面的更新
2 PendingIntent表示接下来有一个Intent将在某个待定的时刻发生
PendingIntent表示将来某个不确定的时刻发生,而Intent是立刻发生
3 PendingIntent的典型应用是给RemoteViews添加单击事件

4 RemoteViews并不能支持所有的View类型,进支持如下类型:
Layout:FrameLayout,LinearLayout,RelativeLayout,GridLayout
View:Button,ImageButton,ImageView,ProgressBar,TextView,ListView,GridView,AnalogClock,Chronometer,ViewFlipper,StackView,AdapterViewFlipper,ViewStub

5 一个应用需要更够更新另一个应用中的某个界面,可以选择AIDL实现,但若界面的更新的比较频繁,就会由效率问题;若采用RemoteViews来更新界面的话,会简单些,但RemoteViews的局限是支持的View类型有限