kivymd/KivyMD

Positioning of MDTopAppBar elements #2

AHiXilTOr opened this issue · 7 comments

Description of the Bug

pos_hint: {"center_x": .5} doesn't work

Code and Logs

from kivymd.app import MDApp
from kivy.lang import Builder

kv = """
MDScreen:
    md_bg_color: self.theme_cls.secondaryContainerColor

    MDTopAppBar:
        type: "small"
        size_hint_x: .8
        pos_hint: {"center_x": .5, "center_y": .5}

        MDTopAppBarLeadingButtonContainer:

            MDActionTopAppBarButton:
                icon: "menu"

        MDTopAppBarTitle:
            text: "AppBar small"
            pos_hint: {"center_x": .5}

        MDTopAppBarTrailingButtonContainer:

            MDActionTopAppBarButton:
                icon: "account-circle-outline"
"""

class App(MDApp):
    def build(self):
        return Builder.load_string(kv)

App().run()
"""


class MainApp(App):
    def build(self):
        self.root = Builder.load_string(kv)


if __name__ == '__main__':
    MainApp().run()

Screenshots

333584429-86ae5ae8-2665-48a5-8985-04b59746f130

Versions

  • OS: Any
  • Python: Any
  • Kivy: Any
  • KivyMD: dev

What is the use case of centering that icon?

It does not matches material design spec.

https://m3.material.io/components/top-app-bar/specs

(It does not declare anywhere to center icons)

What is the use case of centering that icon?

It does not matches material design spec.

https://m3.material.io/comComponents/top-app-bar/specs

(It does not declare anywhere to center icons)

Not an icon, but a title.