Why should I use RemoteViews for Android home screen widgets?

本小妞迷上赌 提交于 2019-12-10 10:18:52

问题


I'm trying to realize an Android home screen widget. I am interested to know why I should use RemoteViews in implementing widgets?


回答1:


Refer this link site.

Creating the App Widget layout is simple if you're familiar with Declaring Layout in XML. However, you must be aware that App Widget layouts are based on RemoteViews, which do not support every kind of layout or view widget.

A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:

FrameLayout
LinearLayout
RelativeLayout

And the following widget classes:

AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView

Descendants of these classes are not supported.




回答2:


Most of the time Widget is hosted within another application, like Launcher, which is run within that parent application's process.

RemoteViews 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.

The main reason behind this choice is related to security and performance.




回答3:


RemoteViews is used for the app widgets. They are part of separate process but bind to the main process i.e. why when we click over widgets it redirects to the associated application with more detailed information.



来源:https://stackoverflow.com/questions/5752445/why-should-i-use-remoteviews-for-android-home-screen-widgets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!