Scrollview update problem

bazp

Member
Licensed User
Longtime User
I have a program with scrollview. There are 2 images per screen and 50 images in all. I would like to be able to press on an image and display a full image. Is this possible?
Any examples would be great.
 
Last edited:

cammel8

Member
Licensed User
Longtime User
I have a program with scrollview. There are 2 images per screen. I would like to be able to press on an image and display a full image. Is this possible?
Any examples would be great.

if the image is on an imageview then you can do an imageview click event

My suggestion, is to put each picture on an imageview of its own (IE: imageview1 and imageview2) then create a new sub for each imageview (IE:imageview1_click and imageview2_click) then when you click the image view bring the pic as a background of a panel but set its height and width to 100%x and 100%y

B4X:
Sub imageview1_Click
   
Dim pic1 As Bitmap
pic1.initialize(File.DirAssets, "name of your file.png")
Dim button1 as button
Dim panel1 As Panel
panel1.Initialize("panel1")
panel1.setbackgroundimage(pic1)
activity.addview(panel1,0,0,100%x,100%y)
activity.addview(button1,0,panel1.height-40dip,100%x, 40dip)
End Sub

Then when you click the imageview it will programatically create panel1 and make the image the full size of the screen then just destroy it when done. and my guess on that would be to add a button to the bottom that when clicked would destroy the panel
B4X:
Sub button1_Click
panel1.removeview   
button1.removeview
End Sub

Then you are back to where you were before clicking

Hope this helps
George
 
Last edited:
Upvote 0

cammel8

Member
Licensed User
Longtime User
my guess on that would be to add a button to the bottom that when clicked would destroy the panel

conversely you probably could just ad a click event to the panel so When the panel is clicked it destroys both as well. just change it from

B4X:
sub button1_click
to
B4X:
sub panel1_click
Then you wouldn't have the button screwing up the view
 
Upvote 0
Top