我正在嘗試在我的 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 被刪除了。我仍然不明白為什么進度條主題不起作用。
添加回答
舉報
0/150
提交
取消