[英]I am developing an Android app using Kivy and I wanted to know that how can I add MDCard in Scrollview? Currently I am using kivyMD and Kivy
Whenever I try this code I get error and also if I keep only MDCard then also its appears but not in Scrollview.每当我尝试此代码时,我都会出错,而且如果我只保留 MDCard,那么它也会出现但不在 Scrollview 中。 This is my code:这是我的代码:
ScrollView:
do_scroll_x: False
do_scroll_y: True
Label:
size_hint_y: None
height: self.texture_size[1]
text_size: self.width
padding: 10, 10
text:
'My text\n' * 100
MDCard:
Label:"Hello"
From the ScrollView documentation :从ScrollView 文档:
The ScrollView accepts only one child ScrollView 只接受一个孩子
That may be the cause of your error.这可能是您的错误的原因。 Try something like this in your kv
file:在你的kv
文件中尝试这样的事情:
ScrollView:
do_scroll_x: False
do_scroll_y: True
BoxLayout:
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height
Label:
canvas.before:
Color:
rgba: 1,0,0,1
Rectangle:
pos: self.pos
size: self.size
size_hint_y: None
height: self.texture_size[1]
padding: 10, 10
text:
'My text\n' * 100
MDCard:
Label:
text: "Hello"
size_hint: 1, None
height: self.texture_size[1]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.