我正在尝试使用Kivy构建一个简单的Android应用程序,其中包含注册和登录功能。现在只是为了测试我在Ubuntu中制作了桌面应用程序,下面是截图。
将图像部署到手机后,我得到了这个结果:
如何设置TextInput,Labels和Button的大小和位置,以便根据Android应用程序提供正确的结果。下面是我的.kv代码
<LoginPage>
Widget:
canvas:
Rectangle:
source: 'data/reso.png'
pos: self.pos
size: self.size
Label:
center_x: (root.width/2)
top: (root.top/2) + 250
text: "TESTING"
color: [0.0,0.0,0.0,0.4]
font_size: 34
TextInput:
id: username
center_x: (root.width/2)
top: (root.top/2)+ 100
size_hint: None,None
hint_text: "username"
background_color: [0.0,0.0,0.0,0.4]
size: 250, 35
max_lines: 1
valign: 'middle'
halign: 'center'
font_size: 15
multiline: False
on_text_validate: root.validate();
TextInput:
id: password
center_x: (root.width/2)
top: (root.top/2) + 50
size_hint: None, None
hint_text: "password"
background_color: [0.0,0.0,0.0,0.4]
size: 250, 35
max_lines: 1
valign: 'middle'
halign: 'center'
font_size: 15
multiline: False
password: True
Button:
size: 90,35
pos: 350, 200
font_size: 18
background_color: (1,1,1,0.1)
text: "Login"
请指导。谢谢。