I can't position my buttons in the center on kivymd, I tried first with a normal boxlayout and then the two buttons but they remain attached to each other, (I tried inserting two labels and they are positioned in the center without problems but with the buttons it's not like that) then I tried to make two layout boxes inside a layout box but one button was placed on the left (to the left of the first layout box which divides the page in half) and the other in the center (to the left of the second layout box ) how can I position them in the center?
kivy code:
BoxLayout:
orientation: "vertical"
BoxLayout:
orientation: "horizontal"
BoxLayout:
MDRectangleFlatButton:
halign: 'center'
pos_hint: {"center_x": .5, "center_y": .5}
text: "hi"
BoxLayout:
MDRectangleFlatButton:
text: "hi"
halign: 'center'
pos_hint: {"center_x": .5, "center_y": .5}
Try this:
The
MDRectangleFlatButtonsets itssize_hintto[None, None], so it does not fill the available space. TheAnchorLayoutleaves the defaultsize_hintof[1, 1], so the two of them evenly share all the available space.