android - 如何在 Kivy 的 Scrollable GridLayout 中显示图像

标签 android python image kivy

我有 Scrollable Grid Layout在 Kivy 中,我试图在该 ScrollView 中添加图像,如下所示。我看不到它,我还试图使该图像根据屏幕分辨率动态更改其大小。

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"


如上面代码中所述,我无法在可滚动布局中添加图像...任何帮助将不胜感激。

最佳答案

尝试禁用 size_hint (至少 y 部分)为您的图像:size_hint_y: None您可能还需要定义一个 size 。
size_hint似乎不起作用(即使是默认的 1、1),但是,因为我没有使用过 GridLayout ,这可能是正常行为。

关于android - 如何在 Kivy 的 Scrollable GridLayout 中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34952860/

相关文章:

html - 如何在html中添加带有文本的模糊图像?

Android 上下文切换中的 javascript settimeout

android - 从右向左滑动无法关闭 NavigationDrawer

python - 如何在 Python 中对具有键作为数字字符串的字典进行排序

javascript - 图像 src 未写入弹出窗口主体?

c# - WPF中如何制作翻页效果?

android - Android:Media Recorder无法启动

android - 如何以编程方式多次设置 ViewPager 高度?

python - 预计 : Is there any way to prevent input overrun while using pexpect?

python - 修改 Celery 节拍计划搁置数据库