简体   繁体   English

如何在 MDToolbar Kivymd 中居中图像?

[英]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?我如何将我的图像居中在工具栏中,以便无论 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. gridLayout 基本上是对 position 中间行图像的尝试,即使这样也不起作用。 How can i write this correctly?我怎样才能正确地写这个?

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

Use in Image Properties.在图像属性中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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