为什么我应该将RemoteViews用于Android主屏幕小部件?
问题描述:
我正在尝试实现一个Android主屏幕小部件.我想知道为什么我应该在实现小部件时使用RemoteViews?
I'm trying to realize an Android home screen widget. I am interested to know why I should use RemoteViews in implementing widgets?
答
如果您熟悉以XML声明布局,则创建App Widget布局非常简单.但是,您必须注意,App Widget布局基于RemoteView,并不支持每种布局或视图Widget.
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.
RemoteViews对象(因此是一个App 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
不支持这些类的后代.