android - 进度条随 int 值变化

标签 android android-studio int progress-bar

感谢您查看这篇文章,我目前正在做一个学校项目,我正在制作一个卡路里计数器应用程序。我快完成了,它工作得很好 我有一个问题,但是我无法在任何地方找到解决方案。 我有一个 int 值,它给出了总卡路里数,我希望它显示在水平进度条中,这样您就可以看到您还可以吃多少卡路里。对此的任何帮助将不胜感激。

非常感谢!

最佳答案

根据 Progress Bar Docs :

setProgress(int progress)

Set the current progress to the specified value.

因此您可以使用此方法将值固定到进度条。

关于android - 进度条随 int 值变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35161928/

相关文章:

c - 在 C 编程期间如何存储数据?

int - Kotlin 编译错误 : None of the following functions can be called with the arguments supplied

android - 以编程方式永久启用和禁用android中闪烁的LED通知灯

Android Studio 没有从 Java 模块中获取 AutoParcelGson (AutoValue) 类

python - android中的丰富链接预览

android - calendar.get(Calendar.MONTH) == Calendar.JANUARY 给出一个 lint 错误

Android:RTL ActionBar 菜单项

java - Android - 获取从文件资源管理器中选择的 .txt 文件的真实路径

android - 尝试运行 jetpack compose 仪器测试时如何克服此构建错误

c# - 将 double 转换为 int,它是四舍五入还是只是去掉数字?