2016-09-28 13 views
0

私の目標は、これらの3つのボタンをスクリーンショットのように画面上部のアクションバーに追加することです。アンカーレイアウトのアクションバー - KIVY。 python

.kvファイル

AnchorLayout: 
    anchor_x: 'center' 
    anchor_y: 'top' 
    BoxLayout: 
     padding: 30 
     size_hint: 1, .1 
     orientation: 'horizontal' 
     Button: 
      text: 'Back' 
      on_press: root.manager.current = 'mainpage'      
     TextInput: 
      text: 'Search'      
     Button: 
      text: 'Fav' 

たツイートと戻るボタンは後のアイコンに変更され、検索がドロップダウン

の.pyファイル

class MainPage(Screen): 
    pass 

enter image description here

になります

答えて

0

私はあなたにお勧めしますボックスレイアウト内の相対的なレイアウト:

BoxLayout: 
    padding: 30 
    size_hint: 1, .1 
    orientation: 'horizontal' 

    RelativeLayout: 

     Button: 
      text: 'Back' 
      pos_hint: {'center_x': 0.1, 'center_y': 0.5} 
      on_press: root.manager.current = 'mainpage' 

     TextInput: 
      pos_hint: {'center_x': 0.5, 'center_y': 0.5} 
      text: 'Search'      

     Button: 
      pos_hint: {'center_x': 0.9, 'center_y': 0.5} 
      text: 'Fav' 
関連する問題