Home | History | Annotate | Download | only in widget
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.widget;
     18 
     19 import android.view.View;
     20 import android.view.ViewGroup;
     21 
     22 /**
     23  * Extended {@link Adapter} that is the bridge between a
     24  * {@link android.widget.Spinner} and its data. A spinner adapter allows to
     25  * define two different views: one that shows the data in the spinner itself and
     26  * one that shows the data in the drop down list when the spinner is pressed.</p>
     27  */
     28 public interface SpinnerAdapter extends Adapter {
     29     /**
     30      * <p>Get a {@link android.view.View} that displays in the drop down popup
     31      * the data at the specified position in the data set.</p>
     32      *
     33      * @param position      index of the item whose view we want.
     34      * @param convertView   the old view to reuse, if possible. Note: You should
     35      *        check that this view is non-null and of an appropriate type before
     36      *        using. If it is not possible to convert this view to display the
     37      *        correct data, this method can create a new view.
     38      * @param parent the parent that this view will eventually be attached to
     39      * @return a {@link android.view.View} corresponding to the data at the
     40      *         specified position.
     41      */
     42     public View getDropDownView(int position, View convertView, ViewGroup parent);
     43 }
     44