Search code examples
javaandroidandroid-gallery

what is this image gallery called in android


I am planning to build this kind of a image view in android i could use your help in how to get started.

enter image description here

enter image description here


Solution

  • Its called Carousel

    See this: carousel layout android

    If you want 3 D Carousel, you can see this post

    You would need to create a custom class for your images, which extends ImageView.

    EXAMPLE:

    public class CarouselImageView extends ImageView 
        implements Comparable<carouselimageview> {
    
        private int index;
        private float currentAngle;
        private float x;
        private float y;
        private float z;
        private boolean drawn;
    
        public CarouselImageView(Context context) {
            this(context, null, 0);
        }   
    
        public CarouselImageView(Context context, AttributeSet attrs) {
            this(context, attrs, 0);
        }
    
        public CarouselImageView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public int compareTo(CarouselImageView another) {
            return (int)(another.z – this.z);
        }
    
    }
    

    You can customize the code as per requirement as to make a horizontal carousel or the vertical one.

    Hope this helps.