Android
android.widget
public class

android.widget.Spinner

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.ViewGroup ViewManager ViewParent
android.widget.AdapterView<T extends android.widget.Adapter>
android.widget.AbsSpinner
android.widget.Spinner DialogInterface.OnClickListener

A view that displays one child at a time and lets the user pick among them. The items in the Spinner come from the Adapter associated with this view.

Summary

XML Attributes

Attribute name Related methods  
android:prompt   The prompt to display when the spinner's dialog is shown. 
XML Attributes inherited from class android.widget.AbsSpinner
XML Attributes inherited from class android.view.ViewGroup
XML Attributes inherited from class android.view.View
Constants inherited from class android.widget.AdapterView
Constants inherited from class android.view.ViewGroup
Constants inherited from class android.view.View
Fields inherited from class android.widget.AdapterView
Fields inherited from class android.view.ViewGroup
Fields inherited from class android.view.View

Public Constructors

            Spinner(Context context)
            Spinner(Context context, AttributeSet attrs)
            Spinner(Context context, AttributeSet attrs, int defStyle)

Public Methods

          int  getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary.

          CharSequence  getPrompt()
          void  onClick(DialogInterface dialog, int which)
This method will be invoked when a button in the dialog is clicked.
          boolean  performClick()
Call this view's OnClickListener, if it is defined.
          void  setOnItemClickListener(AdapterView.OnItemClickListener l)

A spinner does not support item click events.

          void  setPrompt(CharSequence prompt)
Sets the prompt to display when the dialog is shown.
          void  setPromptId(int promptId)
Sets the prompt to display when the dialog is shown.

Protected Methods

          void  onLayout(boolean changed, int l, int t, int r, int b)
Called from layout when this view should assign a size and position to each of its children.
Methods inherited from class android.widget.AbsSpinner
Methods inherited from class android.widget.AdapterView
Methods inherited from class android.view.ViewGroup
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.content.DialogInterface.OnClickListener
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.ViewManager
Methods inherited from interface android.view.ViewParent

Details

XML Attributes

android:prompt

The prompt to display when the spinner's dialog is shown.

Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

This corresponds to the global attribute resource symbol prompt.

Related Methods

Public Constructors

public Spinner(Context context)

public Spinner(Context context, AttributeSet attrs)

public Spinner(Context context, AttributeSet attrs, int defStyle)

Public Methods

public int getBaseline()

Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.

Returns

  • the offset of the baseline within the widget's bounds or -1 if baseline alignment is not supported

public CharSequence getPrompt()

Returns

  • The prompt to display when the dialog is shown

public void onClick(DialogInterface dialog, int which)

This method will be invoked when a button in the dialog is clicked.

public boolean performClick()

Call this view's OnClickListener, if it is defined.

Returns

  • True there was an assigned OnClickListener that was called, false otherwise is returned.

public void setOnItemClickListener(AdapterView.OnItemClickListener l)

A spinner does not support item click events. Calling this method will raise an exception.

Parameters

l this listener will be ignored

public void setPrompt(CharSequence prompt)

Sets the prompt to display when the dialog is shown.

Parameters

prompt the prompt to set

public void setPromptId(int promptId)

Sets the prompt to display when the dialog is shown.

Parameters

promptId the resource ID of the prompt to display when the dialog is shown

Protected Methods

protected void onLayout(boolean changed, int l, int t, int r, int b)

Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their their children.

Parameters

changed This is a new size or position for this view
l Left position, relative to parent
t Top position, relative to parent
r Right position, relative to parent
b Bottom position, relative to parent
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56