ProgressBar in an AppWidget

为君一笑 提交于 2019-12-03 13:42:37

An even simpler idea, is to put the progress bar inside some container (say a linear layout) and show/hide the container.

It might be a bug. There's a particular annotation (@RemotableViewMethod) you need in the Java source code of Android itself to mark a method as being available via RemoteViews. View has this for setVisibility(), but ProgressBar overrides that method and does not have the annotation on its own edition. If @RemotableViewMethod is not inherited, and the override "undoes" the annotation, that would explain the symptom you see.

A workaround is to use two app widget layouts and choose the one you want (with or without ProgressBar) when you create your RemoteViews object when updating your app widget.

I'll make a note to try to replicate this and, if I see the same thing, I'll post an issue on it on the Android issue tracker.

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