gpt4 book ai didi

android - 使用 AppCompatButton 崩溃的 MaterialTimePicker 无法转换为 MaterialButton

转载 作者:行者123 更新时间:2023-12-02 13:41:05 25 4
gpt4 key购买 nike

 <style name="AppTheme" parent="Theme.MaterialComponents.Light.Bridge">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
当我尝试显示新的 Material 时间选择器时:
MaterialTimePicker.newInstance().show(supportFragmentManager, "time")
我得到这个崩溃:
java.lang.ClassCastException: androidx.appcompat.widget.AppCompatButton cannot be cast to com.google.android.material.button.MaterialButton
at com.google.android.material.timepicker.MaterialTimePicker.onCreateView(MaterialTimePicker.java:194)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2698)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:320)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1187)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1434)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1497)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2169)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1992)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
非常感谢您的帮助🙏🏽。

最佳答案

有一个 bug1.3.0-alpha02.Bridge主题。
它已从 开始修复1.3.0-alpha03 .

关于android - 使用 AppCompatButton 崩溃的 MaterialTimePicker 无法转换为 MaterialButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63383315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com