Android StackView

Android StackView

StackView helps in arranging items in the form of stacked cards, where the front item can be flipped to bring the item behind it to the front. In addition to images, you can stack objects composed of text and other data, too.


In this example I will show how to make use of stack images in the StackView.


Let’s get start by creating a project in Eclipse IDE.

1. Create a new project in Eclipse by navigating to File ⇒ New Android ⇒ Application Project and fill required details. (I kept my main activity name as

2.  Create a layout file for under res ⇒ layout folder. I named the layout file as activity_main.xml. In this layout i had taken StackView for showing stack of images.

3. Before, making stackview of images you have to create a custom xml layout and custom adapter for it like we had done in listview and gridview. Now, create a new xml file for custom layout naming display_item.xml.

4. Now create a getter setter class for custom adadpter naming

5. Now make custom adapter class naming  and add the following code.

6. Finally come to and add the following code. In this class we just had taken arraylist for images and texts and just setting the custom adapter over the stackview.

7. Now, run the app and you will get the output as shown in video.

Thanks. :)

Download Source Code


About the author

I am an Android developer for whom Android is the one and only love. I work as a freelancer which gets me and Android closer. I always love to share my learnings and love to learn from others knowledge too.


hey thanks for this tutorial its very rear.

Can i put images in same row i mean they are like stairs but i want them like on top of each other ?

I hope you understand my point.



    Yeah, we can achieve this thing also with some more effort. But right now i am not having any demo to show.


How can I arrange screens(acivities) instead of images in the demo?

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)