简体   繁体   中英

How do I Center Image in MDToolbar Kivymd?

How do i center my image inside the toolbar so that its always in the center no matter how big or small the window?

            MDToolbar:
                left_action_items: [['menu', lambda x: nav_drawer.set_state()]]
                theme_text_color: 'Custom'

                GridLayout:
                    cols: 3
                    cols_minimum: {0: 100, 1: 800, 0:100}

                    Image:
                        source: 'images/FS_Logo1_textHeader.png'
                        size_hint_x: None
                        width: 500
                        allow_stretch: True
                        keep_ratio: True

This is the code im attempting but it obviously doesn't work. The gridLayout is basically an attempt to position the image in the middle row and even that doesnt work. How can i write this correctly?

pos_hint: { "center_x": .5, "center_y": 1 }

Use in Image Properties.

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