两天后,我在单击自定义 AppCompatSpinner 时遇到了 IllegalArgument 异常(鉴于下面的崩溃日志)。此问题并非在所有设备中都发生,只有少数设备(三星、一加)受到影响。下面列出了所有 api 版本的应用程序主题
parent="Theme.AppCompat.NoActionBar"
v23 主题:
parent="Theme.AppCompat.Light.NoActionBar"
v21 主题:
parent="Theme.MaterialComponents.DayNight.NoActionBar"
我的崩溃日志:
E/AndroidRuntime: FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #95: Binary XML file line #37: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #37: Error inflating class Button
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
请提供一些见解以解决此问题。在 stackoverflow 和其他站点中找到了一些解决方案,但没有任何帮助我解决问题