Android Tutorial Simple Photogallery using a Scollview

hi,

this is a simple example that shows how you can use a scrollview and create a photo gallery.

(source code is included)

have fun :)
 

Attachments

  • ScrollView - B4A.zip
    49.9 KB · Views: 540
  • Screenshot_20181228-154021.jpg
    Screenshot_20181228-154021.jpg
    132 KB · Views: 732

Erel

B4X founder
Staff member
Licensed User
Longtime User
In most cases there is no good reason to use ScrollView directly. Use xCustomListView instead. It will be simpler and it includes many features that you will need to implement anyway. In this case it would have been better to use lazy loading and only load the images when needed.
xCustomListView is also cross platform.
https://www.b4x.com/android/forum/threads/87930/#content
 

ilan

Expert
Licensed User
Longtime User
Why? Is there any technical reason? Or is it just because of the existing and better views?

maybe in most cases it is true anyway in my case its not. clv is creating 1 item per row but here you can see that i am creating more then one. But the lazyloading is a nice feature that could be implemented in my case too. anyway i noticed that showing a scrollviewwith 200-300 items does not have any effect on performance. at least not on my galaxy s8 so i guess in some case you can use your own implementation and in maybe most clv would be simpler (maybe)
 

Mahares

Expert
Licensed User
Longtime User
It should be difficult to change the example
You are absolutely correct. It is difficult. I tried for several hours without success to have each 4 images in a single row and displaying all 200 images in succession. I managed something, but only if I display image files at random. It would be interesting to see how you manage to do it using your project with the link in post#7.
I used your quote in post #7 verbatim, because I have a feeling you meant to say: 'It should NOT be difficult'.
 
Top