简体   繁体   中英

How can I use Layout background in kivy language

How use kivy language set StackLayout background, in stacklayout.py ,I can't found how to use;

<MainScreen>:
    view: view
    FloatLayout:
        StackLayout:
            orientation: 'lr-bt'
            spacing: 50
            id: view
            pos: 0, 20
            background_color:(1,1,1,1)
            ButtonImage:                                                                                                                                                                                                                    
                image: 'bv_a_pic_confirm'
                callback: root.do_confirm
                no_toggle: True

Layout and Widget classes don't have the property background_color. Instead use canvas:

StackLayout:
    canvas:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM