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
     26  * and one that shows the data in the drop down list when the spinner is
     27  * pressed.
     28  */
     29 public interface SpinnerAdapter extends Adapter {
     30     /**
     31      * Gets a {@link android.view.View} that displays in the drop down popup
     32      * the data at the specified position in the data set.
     33      *
     34      * @param position index of the item whose view we want.
     35      * @param convertView the old view to reuse, if possible. Note: You should
     36      *        check that this view is non-null and of an appropriate type before
     37      *        using. If it is not possible to convert this view to display the
     38      *        correct data, this method can create a new view.
     39      * @param parent the parent that this view will eventually be attached to
     40      * @return a {@link android.view.View} corresponding to the data at the
     41      *         specified position.
     42      */
     43     public View getDropDownView(int position, View convertView, ViewGroup parent);
     44 }
     45