Search code examples
androidgalleryhorizontalscrollview

Gallery view with circular effect to both edges


I am working on application in which gallery require as bellow image :

enter image description here

I searched over internet but it gives result similar to Image Gallery. But I want to create the gallery which will move in circular fashion, means it just bend the first and last member of gallery. Is it possible? or Is the horizontal ScrollView better approach to do this?

Any better approach will be appreciated.. Thanks in advance.


Solution

  • I have found a solution and it achieved using Custom Gallery. I used following layout file for that

    main.xml

        <?xml version="1.0" encoding="utf-8"?>
        <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/linear_layout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/gal_bg"
            android:orientation="vertical" >
    
            <Gallery
                android:id="@+id/horizontallistview"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="40dp"
                android:layout_marginRight="40dp" />
            <!-- android:background="@drawable/gal_overlay" -->
    
            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="120dp"
                android:background="@drawable/gal_overlay" />
    
        </FrameLayout>
    

    And it uses the some images as background to FrameLayout and ImageView. You will find the complete source code of project on GitHub.

    Happy Coding..