KivyMD Buttons : How increase its dimensions

Viewed 3459

I am trying to increase the width and the height of a kivyMD button, but it is not supported (size_hint).

•Should I make my own button class that inherits from the Button class ?

•Would that be bad considering I want my app to go on android ?

I would like to know if anyone solved this issue before. Also, if I increase the dimensions of the button, I want the size of the text to change, too...

2 Answers

For example with MDRaised button type This is how you do it:

MDRaisedButton:
        text: "Do Something"
        pos_hint: {'center_x': .5, 'center_y': .5}
        on_release: app.do_anything()
        size: 30, 30
        size_hint: None, None

Make sure you set size_hint to None, None and then specify size: width, height

This is an old post but I ran into the same issue. I had to use it a percentage of the root width and it worked. Example below:

MDRectangleFlatButton:
            text: "Some text"
            pos_hint: {"center_x": .5}
            size_hint: None, None
            width: root.width*0.4
Related