我正在尝试在我的 xml 文件中添加进度条。一旦用户在三个字段中输入数据并单击“提交”按钮,就会显示此进度条,然后启动新的活动。
这是 Logcat 主错误行
无法启动活动 ComponentInfo{com.example.hadithapp/com.example.hadithapp.AddHadithDetailActivity}: android.view.InflateException: Binary XML file line #99: Binary XML file line #99: error inflating class android.widget.ProgressBar
下面是进度条 xml 代码
<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_bar_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 代码中的主题行时,ERROR 被删除了。
我仍然不明白为什么进度条主题不起作用。
HUX布斯
墨色风雨
相关分类