Spinner

Basic spinner design

SDK Version: 
M3

In android creating spinners - known as comboboxes or Drop-down list in other systems - is easy. However giving them a basic design is a little tricky.

In most application we dont want to add custom design to spinners, but at least we want thicker items in the list. With the default look, people will have trouble hitting the desired item.

The code, one may try at first, to fill a spinner with elements, will probably look like this:

The layout xml 'mylayout.xml':

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent">
  6.  
  7.         <Spinner android:id="@+id/myspinner"
  8.         android:layout_width="wrap_content"
  9.         android:layout_height="wrap_content" />
  10.  
  11. </LinearLayout>

In the Activity oncreate method:

  1. setContentView(R.layout.mylayout);
  2. ArrayAdapter myAdapter = new ArrayAdapter(this,

TourGuide - Virtual Sightseeing

SDK Version: 
M5

This tutorial creates a MapActivity which has a spinner floating above a MapView. You can select different locations from the spinner and hit the button to view that location. The locations are a handful of the "Most Popular Destinations" from http://www.satellite-sightseer.com/

Syndicate content