from kivymd.app import MDApp
from kivymd.uix.boxlayout import BoxLayout
from kivymd.uix.textfield import MDTextField
class Mywidget(BoxLayout):
pass
class Myapp(MdApp):
def build(self):
return Mywidget()
Myapp().run()
Kv 文件:-->myapp.kv
<Mywidget>
orientation:"horizontal"
MDTextField:
halign:"center"
valign:"center"
hint_text:"Enter your name"
foreground_color:1,1,0,1
但是文本字段的前景色没有改变。我该如何更改它。我在互联网上检查了它的解决方案,但没有任何反应。
MDTextField
line_color_focus: 1, 0, 1, 1
https://kivymd.readthedocs.io/en/latest/components/text-field/index.html#color-mode
MDTextField:
text_color_normal: 1,0,1,1
您可能还想更改“text_color_focus”。