2017-06-07 1 views
0

すべてのウィジェットは左下にあり、サイズは小さいです。size_hintとpos_hintとFloatLayoutを試しましたが、結果はありません。何が問題なのですか?Kivy。 Android上での不思議な表示

これは、このアプリは私のPC上でどのように見えるかです

#: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 

答えて

1

.kvファイルです:

On PC

そして、これが、それは私のAndroidデバイス上でどのように見えるかです:

On Android

私はguessinですあなたのためにまだ小さすぎるグラム、ここでボタンを大きくするための方法があります:

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' 
''')) 

は、ここでそれが今どのように見えるかです:アンドロイドで

New PC

New Android

関連する問題