首页 > 解决方案 > 如何将 RoundCornerProgressBar 与 ButterKnife 绑定

问题描述

我在 android 中使用RoundCornerProgressBar自定义进度条库,我使用JakeWharton butterknife绑定元素,

所以我试着像

@BindView(R.id.volume_progress_bar) ProgressBar volumeBar;

volumeBar.setProgress(tagVolume); //to increase progress bar value

日志说

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testproject/com.example.testproject.MainActivity}: java.lang.IllegalStateException: View 'volume_progress_bar' with ID 2131296532 for field 'volumeBar' was of the wrong type. See cause for more info.

错误说

查看 ID 为 2131296532 的字段“volumeBar”的“volume_progress_bar”类型错误。

那么如何为RoundCornerProgressBar使用 wright 类型,或者如何增加进度条的值Java

标签: androidbutterknife

解决方案


这对我有用IconRoundCornerProgressBar

使用黄油刀,我使用如下

@BindView(R.id.volume_progress_bar) IconRoundCornerProgressBarnn volumeBar;

它奏效了。


推荐阅读