首页 > 解决方案 > Kivy/KivyMD 屏幕在 Android 上加载需要 10 秒,在 Windows 上加载需要 3 秒

问题描述

我们正在开发一个有很多屏幕和很多 kv 代码的应用程序,使用Kulothungan 在 GitHub 上的延迟加载模板,它很好,除了一个屏幕,计算器。在 Android 上加载需要 10 秒或更长时间,我们不明白为什么!

部分代码:

# ----- Python Class: -----
class CustomRoundButton(ButtonBehavior, CircularRippleBehavior, CircularElevationBehavior, MDFloatLayout):
    pass

# ----- KV Class: -----

<Calculator>
    name: "calculator"
    
    MDBoxLayout:
        padding: "35dp"
        spacing: "25dp"
        orientation: "vertical"
        
        MDLabel:
            id: calclabel
            text: "0"
            halign: "right"
            valign: "center"
            font_style: "H2"
            size_hint_y: .4
            pos_hint_y: .5
            
            
        GridLayout:
            cols: 4
            spacing: "15dp"
            
            CustomRoundButton:
                pos_hint: {"center_x": .5, "center_y": .5}
                radius: lbl.texture_size[0]  + self.height / 2
                md_bg_color: app.theme_cls.accent_color
                size_hint_y: None
                height: self.width
                elevation: 8
                on_release:
                    root.calcformula = ""
                    calclabel.text = "0"
                
                Label:
                    id: lbl
                    text: "AC"
                    font_size: root.height / 20
                    -text_size: None, None
                    size_hint: None, None
                    size: self.texture_size[0] + dp(50), self.texture_size[0] + dp(50)
                    pos_hint: {"center_x": .5, "center_y": .5}
                    color: 1, 1, 1, 1
...

这是整个屏幕代码的链接

任何帮助将非常感激!谢谢!

标签: pythonkivylazy-loadingscreenloading

解决方案


推荐阅读