我的 MD FloatLayout 及其属性未显示在屏幕上

My MDFloatLayout and its properties isnt displaying on the screen

我试图在kivyMD中用canvas设计一个主屏幕,我成功地创建了上下椭圆,但现在我一直试图在屏幕上显示其他内容,但无论如何都没有显示我把它放在什么位置。我的kv代码在下面...

Template = '''
MDFloatLayout:
    MDFloatLayout:
        
        pos_hint: {'center_x':0,'center_y': 1.2}
        canvas.before:
            Color:
                rgb: (132/255, 0, 117/255, 0)
            Ellipse:
                pos: self.pos
                size: self.size[0]*2, self.size[0]/1.75
                source: "test.jpg"


    #This MDLabel is one of the contents not being displayed
    MDLabel:
        pos_hint: {'center_x': .23, 'center_y':2.9}
        text: '568 followers'
        bold: True

    MDFloatLayout:
        pos_hint: {'center_x':0, 'center_y':0}
        canvas:
            Color:
                rgb: (223/255, 237/255, 240/255, 0)
            Ellipse:
                pos: self.pos
                size: self.size[0]*2, self.size[0]* 1.95

#This FloatLayout below isnt being displayed too
    MDFloatLayout:
        size_hint: None, None
        size: dp(200), dp(240)
        pos_hint: {'center_x': .3, 'center_y':.3}
        radius: [dp(20)]*4
        md_bg_color: 250/255, 250/255, 250/255, 0

您发布的 kv 中的大部分小部件填满了整个屏幕,隐藏了它们后面的任何内容。请注意,默认的 size_hint(1,1)。此外,pos_hint 对应 MDLabel:

pos_hint: {'center_x': .23, 'center_y':2.9}

MDLabel 的中心设置为远远超出显示的顶部。

尝试更改默认设置 size_hint 并调整 pos_hint。不知道你的目标是什么,我修改了你的 kv 只是为了让一切都可见:

MDFloatLayout:
    MDFloatLayout:

        pos_hint: {'center_x':0,'center_y': 1.2}
        canvas.before:
            Color:
                rgb: (132/255, 0, 117/255, 0)
            Ellipse:
                pos: self.pos
                size: self.size[0]*2, self.size[0]/1.75
                source: "test.jpg"


    #This MDLabel is one of the contents not being displayed
    MDLabel:
        pos_hint: {'right': 1, 'y':0}
        size_hint: 0.2, 0.2
        text: '568 followers'
        bold: True

    MDFloatLayout:
        pos_hint: {'center_x':0, 'center_y':0}
        size_hint: 0.5, 0.5
        canvas:
            Color:
                rgb: (223/255, 237/255, 240/255, 0)
            Ellipse:
                pos: self.pos
                size: self.size[0]*2, self.size[0]* 1.95

#This FloatLayout below isnt being displayed too
    MDFloatLayout:
        size_hint: None, None
        size: dp(200), dp(240)
        pos_hint: {'center_x': .3, 'center_y':.3}
        radius: [dp(20)]*4
        md_bg_color: 250/255, 250/255, 250/255, 0