Nisarg
Nisarg

Reputation: 473

How to show image in Scrollable GridLayout in Kivy

I have Scrollable Grid Layout in Kivy and I am trying to add Image in that Scrolling view as below.I am not able to see it and I am also trying to make that image change it's size as per dynamically as per screen resolution.

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"

as mention in code above I can not add image in the scroll able layout...any help will be appreciated.

Upvotes: 5

Views: 683

Answers (1)

unjuan
unjuan

Reputation: 68

Try disabling the size_hint (the y part at least) for your Image:
size_hint_y: None
You'll probably need to define a size , also.

size_hint doesn't seem to work (even the default 1, 1) but, since I haven't worked with a GridLayout, this might be the normal behavior.

Upvotes: 2

Related Questions