[英]Action bar in anchorlayout - KIVY. python
我的目标是将这3个按钮添加到屏幕顶部的操作栏中,如屏幕截图所示,请提供帮助。
.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
我建议您在盒子布局中使用相对布局:
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'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.