Java android.view.InflateException:二进制XML文件行#99:二进制XML文件行#99:膨胀类android.widget.ProgressBar时出错
我正在尝试在xml文件中添加Progressbar。当用户在三个字段中输入数据并单击“提交”按钮时,将立即显示此进度条,然后新活动将开始 这是Logcat主错误行 无法启动activity ComponentInfo{com.example.hadithapp/com.example.hadithapp.AddHadithDetailActivity}:android.view.InflateException:二进制XML文件行#99:二进制XML文件行#99:膨胀类android.widget.ProgressBar时出错 下面是ProgressBarXML代码Java android.view.InflateException:二进制XML文件行#99:二进制XML文件行#99:膨胀类android.widget.ProgressBar时出错,java,android,xml,Java,Android,Xml,我正在尝试在xml文件中添加Progressbar。当用户在三个字段中输入数据并单击“提交”按钮时,将立即显示此进度条,然后新活动将开始 这是Logcat主错误行 无法启动activity ComponentInfo{com.example.hadithapp/com.example.hadithapp.AddHadithDetailActivity}:android.view.InflateException:二进制XML文件行#99:二进制XML文件行#99:膨胀类android.widge
<ProgressBar
android:id="@+id/interminate_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="visible"
android:theme="@style/ProgressBarTheme"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
下面是样式xml代码
<style name="ProgressBarTheme">
<item name="android:backgroundTint">@drawable/progress_bar_bg</item>
<item name="android:background">@drawable/progress_bar_bg</item>
</style>
@可绘制/进度条
@可绘制/进度条
这是@drawable/progress\u bar\u bg代码
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="360dp"/>
<solid android:color="@color/colorPrimary"/>
</shape>
我不知道是什么导致了错误。但是,当我删除progress_bar xml代码中的主题行时,错误被删除了
我仍然不明白为什么progressbar主题不起作用。当我删除行android:theme=“@style/ProgressBarTheme”时,错误消失了
但我想得到像upwork一样具有圆形背景的progressbar,我通过添加mProgressbar.setBackground(getDrawable(R.drawable.Progressure_bar_bg));以编程方式显示代码行。:) 将
android:theme=“@style/ProgressBarTheme”
更改为style=“@style/ProgressBarTheme”我也犯了同样的错误。我只是通过编程方式在行下添加mProgressbar.setBackground(getDrawable(R.drawable.progressbar\u bg)),解决了这个错误;如果这不是你问题的答案,请不要将其作为答案发布。