[英]kivy scroll layout issue
class Template_Screen (Screen):
pass
以上是我添加到應用程序 class 中的 class 如下
class MAKE_HTML(App):
"""
Still i need to write it fully.... Thanks for patience.....
"""
def build(self):
sm = ScreenManager()
sm.add_widget(Template_Screen(name='Select Template'))
我正在使用如下的kv文件
#the below screen gives the template
<Template_Screen>
ScrollView:
do_scroll_y:True
do_scroll_x: False
GridLayout:
size_hint_y:None
cols:1
height:self.minimum_height
BoxLayout:
Image:
source: "Images/Templates Pictures/Temp-1.png"
Label:
text:"Some sort of text\n Some text"
問題:
我想像 o/p 一樣滾動上面。
ScrollView
的effect_cls
的默認值為DampedScrollEffect
, 文檔將其描述為:
DampedScrollEffect:當前默認值。 允許用戶滾動超出正常邊界,但一旦釋放觸摸/單擊,內容 spring 就會返回。
這就是您看到的自動滾動效果。 您可以通過使用ScrollEffect
作為effect_cls
來消除該行為,但這也會阻止您在內容未填充ScrollView
時滾動
當您對GridLayout
使用height:self.minimum_height
時,您必須為每個孩子提供一個height
。 由於您希望Image
是Screen
大小的一半,因此可以使用這樣的kv
:
#the below screen gives the template
<Template_Screen>
ScrollView:
do_scroll_y:True
do_scroll_x: False
effect_cls: 'ScrollEffect'
GridLayout:
size_hint_y:None
cols:1
height:self.minimum_height
BoxLayout:
size_hint: None, None
size: root.width/2, root.height/2
Image:
source: "mages/Templates Pictures/Temp-1.png"
allow_stretch: True
keep_ratio: True
Label:
text:"Some sort of text\\n Some text"
size_hint: None, None
size: self.texture_size
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.