scroll_type
является OptionProperty
и по умолчанию [‘content’]
.
Попробуйте добавить effect_cls: "ScrollEffect" , scroll_type: ['bars'] и bar_width: 8 для ScrollView.
Фрагменты
ScrollView:
id:main_field
do_scroll_y:True
pos_hint: {'top': 1}
bar_width: 8
bar_color: 1, 0, 0, 1 # red
bar_inactive_color: 0, 0, 1, 1 # blue
effect_cls: "ScrollEffect"
scroll_type: ['bars']
Пример
main.py
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.lang import Builder
Builder.load_file('main.kv')
class UpperBar(Widget):
pass
class MainField(Widget):
pass
class LowerBar(Widget):
pass
class Test(Widget):
pass
class TestApp(App):
def build(self):
return Test()
if __name__ == '__main__':
TestApp().run()
main.kv
#:kivy 1.10.1
<Test>:
BoxLayout:
orientation:'vertical'
size:root.size
AnchorLayout:
id:upper_bar
anchor_x:'left'
anchor_y:'top'
ActionBar:
size_hint_y:None
size_hint_x:1
height:30
ActionView:
ActionPrevious:
with_previous: False
title:''
app_icon:''
ActionGroup:
text:'File'
mode:'spinner'
ActionButton:
text:'Open'
ActionButton:
text:'Add New Obj'
AnchorLayout:
id:main_field
anchor_x:'center'
anchor_y:'center'
size_hint_y:None
size_hint_x:1
height:root.height - upper_bar.height - lower_bar.height
ScrollView:
id:main_field
do_scroll_y:True
pos_hint: {'top': 1}
bar_width: 8
bar_color: 1, 0, 0, 1 # red
bar_inactive_color: 0, 0, 1, 1 # blue
effect_cls: "ScrollEffect"
scroll_type: ['bars']
ScatterLayout:
size_hint:[None,None]
size:1000,1000
canvas:
Rectangle:
pos:10,10
size:100,200
Rectangle:
pos:300,150
size:100,200
AnchorLayout:
id:lower_bar
size_hint_y:None
size_hint_x:1
height:30
anchor_x:'left'
anchor_y:'bottom'
Button:
text:'lower bar'
Выход