Nis*_*arg 5 python android image kivy
我Scrollable Grid Layout在 Kivy 中,尝试在滚动视图中添加图像,如下所示。我看不到它,我还尝试使该图像根据屏幕分辨率动态更改其大小。
Screen:
name:"easy_1_1"
canvas.before:
Color:
rgba:0.2,0.3,0.4,1
Rectangle:
size:self.size
BoxLayout:
orientation:"vertical"
padding:20
spacing:10
ScrollView:
GridLayout:
size_hint: (1, None)
height: self.minimum_height
id: layout_content
cols: 1
spacing:10
padding:10
rows:3
Label:
text_size:self.size
text:"[b]What is Programming ?[/b]"
size_hint_y:None
valign: 'top'
font_size:"24sp"
color:1,1,1,1
markup:True
height:"100sp"
halign:"left"
halign:'center'
Label:
text_size:self.size
text:"test"*100
size_hint_y:None
valign: 'top'
font_size:"17sp"
color:1,1,1,1
markup:True
height:"660sp"
halign:"left"
halign:'center'
#PRoblem is here can not see the image
Image:
source:"aa.png"
Button:
text:"Back"
pos_hint_x:None
size_hint_y:None
height:"30dp"
background_normal: 'blue_with_finger.png'
background_down: 'bb1.png'
on_release:sm.current="easy_1"Run Code Online (Sandbox Code Playgroud)
正如上面代码中提到的,我无法在可滚动布局中添加图像......任何帮助将不胜感激。
尝试禁用size_hint您的图像(至少是 y 部分):
size_hint_y: None
您可能还需要定义一个 size 。
size_hint似乎不起作用(即使是默认的 1, 1),但是,由于我没有使用过 a GridLayout,这可能是正常行为。
| 归档时间: |
|
| 查看次数: |
680 次 |
| 最近记录: |