Alan Moore
Alan Moore

Reputation: 6575

How to create a grid thumbnail gallery with photo browser for Android

I've just written an app with a nice photo gallery for iOS, now I'd like to do the same thing with my Android version of the app. I see that the Android Gallery API allows me to build a scrolling gallery of images. But what I really want is an apple-photo gallery style interface with a grid of thumbnails which, when tapped, open up a full screen display of the selected image and allows me to navigate through the photo gallery using swipes or left/right arrows on a tool bar.

In iOS I used the KTPhotoBrowser to achieve this interface, but I haven't been able to find anything like that for Android. Can anybody point me to a library, or even a tutorial with example code which will give me an interface like that without having to roll it myself?

Update: I've found the GridView Tutorial which describes how to put image thumbnails into a grid, seems to be the perfect thing. The Gallery API can be used for the full size photo browser as shown in @ariefbayu sample code (see link in comments below). It's not quite the same as the iPhone style gallery, but it's pretty good.

Upvotes: 3

Views: 6332

Answers (1)

ariefbayu
ariefbayu

Reputation: 21979

I've done this kind of interface. The basic is:

  1. MainActivity load images into GridView.
  2. On each Gallery click, load another activity using Intent, called SlideActivity which extends 'Gallery' in full screen mode where this will:
    1. show Gallery and set current image to selected
    2. set currently selected image in gallery, to what is clicked in first layout.

Link to sample code: https://www.dropbox.com/s/xk2oupma8zcxqpf/GridToGallery.zip

Upvotes: 6

Related Questions