安卓小部件(App Widget) "加载小部件时出现问题" 的原因

今天做了个小部件,模拟器打开,添加到桌面时,无法显示。
这里写图片描述

后来看了下谷歌文档,小部件根布局支持类型有限。

当时外层用的ConstraintLayout 所以无法加载。

小部件的布局文件支持如下布局:
FrameLayout
LinearLayout
RelativeLayout
GridLayout

以及如下控件
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper

如果有其他小伙伴出现了该问题,希望能有帮助。

猜你喜欢

转载自blog.csdn.net/thezprogram/article/details/81080442