'Numeric Keyboard with Kivy / KivyMD for MDTextField
How to make the Text Fields use the numeric android keyboard instead of the normal keyboard with all the letters? NOTE: I'm using KivyMD MDTextFields So when I click to write in the text fields a keyboard like this appears instead:
Solution 1:[1]
In the py file I created my own class for custom keyboard:
class CustomTextField(MDTextField):
def __init__(self, *args, **kwargs):
self.input_type = "number"
self.input_type = "tel"
self.input_filter = 'float'
self.multiline = False
super().__init__(**kwargs)
And then in the buildozer.spec file I changed the line:
p4a.branch = master
to:
p4a.branch = develop
Solution 2:[2]
I was having this same problem, I found an article where it said to use the input_type: 'number' inside your MDTextField that opens the android numeric keypad! I'm compiling my code again to see if it checks. Ex.:
MDTextField:
id: quantidade
pos_hint: {"center_x": .5, "center_y": .5}
input_type: 'number'
hint_text: "Qtd."
helper_text_mode: "on_error"
helper_text: 'Insira uma quantidade (Apenas NĂºmeros, "," e ".")'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | patrick.genova |
