打开谷歌api,对widget小部件做如下说明: App Widgets are miniature application views that can be embedded in otherapplications(such as the Home screen) and receive periodic updates. These views arereferred to as Widgets in the user interface,and you can publish one
官方有话这样说: 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 Text
一.创建一个简单的小部件 namespace common\components; //common需要自己先设定一个别名 use yii\base\Widget; //小部件需要继承的基类 use yii\helpers\Html; class HelloWidget extends Widget { public $message; //使用小部件时传递的参数 /** * init() 方法处理小部件属性, */ public function init() { parent::init()