Android Spinner

Android Spinner

Spinner is a widget similar to a drop-down list for selecting items.


In this example I will show you how to implement Simple and Custom Spinner in Android.


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 used two Spinner, one for simple and one for custom.

3. For custom Spinner we have to make a new layout for custom view naming custom_spinner_layout.xml under layout folder. In this layout i had just taken an ImageView and a TextView.

4. Now create a new class naming  for getter and setter for custom view.

5. Now make a custom adapter class naming  for inflating custom view and add the following code.

6. Finally, come to and add the following code. In this class we load both the spinners (Simple and Custom) with some data and set adapter to both the spinners. And a toast will be shown when the item is selected from spinner.

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.

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)