如何在 android 的小部件中以编程方式设置辅助进度?

How to set secondaryProgress programatically in widget in android?

需要在小部件中显示主要和次要进度。

RemoteViews class 有以下方法,我可以在其中传递最大值和进度值,但不能传递 secondaryProgress。

remoteViews.setProgressBar(R.id.pbHorizontal, 100, 50, false); 

任何提示或建议将不胜感激,谢谢。

据我所知没有直接的方法,但你可以设置 int 属性 使用 RemoteViews.

手动查看视图

有个方法setInt

setInt(viewId, "setSecondaryProgress", secondaryProgress);

setProgressBar() 使用它 under the hood