绝望的。 android 的奇怪观点

Kivy. Strange view on android

在 Android(仅)设备上,所有小部件都位于左下角并且有小 sizes.I 尝试使用 size_hint 和 pos_hint 以及 FloatLayout,但是有没有results.What错了吗?

这是 .kv 文件

#:kivy 1.0.0
#:import win kivy.core.window

Widget:

    Label:
        id:TopLabel
        text:'Eye verification app'
        width: self.texture_size[0] + dp(40)
        height: '48dp'
        pos: 40,40
        bold:True
        color:1,0,0,1

    Button:
        id:registrateButton
        on_release:

            app.take_picture('registrate')
        text: 'Registrate'
        width: self.texture_size[0] + dp(40)
        height: '48dp'
        pos: 40,160

这是您的应用在我的电脑上的样子:

这是它在我的 Android 设备上的样子:

我猜这对你来说还是太小了,这里有一种方法可以让按钮变大:

from kivy.base import runTouchApp
from kivy.lang import Builder

runTouchApp(Builder.load_string('''
#:kivy 1.0.0
#:import win kivy.core.window

FloatLayout:

    Label:
        id:TopLabel
        text:'Eye verification app'

        size_hint: 0.8, 0.2 # to react to the screen's size
        pos_hint: {"top": 0.4, "center_x": 0.5} # to place where we want it on the screen

        bold:True
        color:1,0,0,1

    Button:
        id:registrateButton
        on_release:
            app.take_picture('registrate')

        size_hint: 0.8, 0.2 # the same as previous
        pos_hint: {"top": 0.7, "center_x": 0.5} # top is a little lower

        text: 'Registrate'
'''))

现在是这样的:

在 Android: