[英]Numeric Keyboard with Kivy / KivyMD for MDTextField
如何使文本字段使用数字 android 键盘而不是带有所有字母的普通键盘? 注意:我正在使用 KivyMD MDTextFields 所以当我点击在文本字段中写入时,会出现这样的键盘:
我遇到了同样的问题,我找到了一篇文章,其中说在打开 android 数字键盘的input_type: 'number'
使用input_type: 'number'
! 我正在再次编译我的代码以查看它是否检查。 前任。:
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 ".")'
在 py 文件中,我为自定义键盘创建了自己的类:
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)
然后在 KV 文件中更改了这一行:
p4a.branch = master
到:
p4a.branch = develop
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.