我正在尝试使用具有 .SVG 图像支持的 Glance Jetpack 创建一个 Appwidget。
我可以使用下载位图
ImageRequest.Builder(this)
.data(url)
.decoderFactory(SvgDecoder.Factory())
...正如在日志记录的最后一行中看到的,有一个非空位图分配给var coinImage
.
The problem is, the widget doesn't seem to re-compose after the bitmap's value changes. I'm stuck seeing the circularProgressSpinner.
What am I missing/doing wrong? Am I missing something foundational with the composition's state?
我的代码和 logcat 位于:https://gist.github.com/Alvtag/5bd46a2007e6c4f382d431e43aa96e80 https://gist.github.com/Alvtag/5bd46a2007e6c4f382d431e43aa96e80
任何帮助表示赞赏!
当前的 Glance alpha05 不支持重组。
部分重组支持将在下一个版本中提供。您可以使用快照来访问它。
如果不重新组合,您应该遵循此示例https://github.com/android/user-interface-samples/blob/main/AppWidget/app/src/main/java/com/example/android/appwidget/glance/image/ImageGlanceWidget.kt https://github.com/android/user-interface-samples/blob/main/AppWidget/app/src/main/java/com/example/android/appwidget/glance/image/ImageGlanceWidget.kt
通过重组支持,它将被简化https://gist.github.com/marcelpinto/6df5e3e6ca42c6a0bf34b9f4b6eb1cff https://gist.github.com/marcelpinto/6df5e3e6ca42c6a0bf34b9f4b6eb1cff
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)