ディレクトリ 検索
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
テキスト


ExpandableListAdapter

翻译时间:2011-1-25

版本:Android 3.0 r1

结构

继承关系

public interface ExpandableListAdapter

 

android.widget.ExpandableListAdapter

 

子类及间接子类

间接子类         BaseExpandableListAdapter,CursorTreeAdapter,ResourceCursorTreeAdapter, SimpleCursorTreeAdapter, SimpleExpandableListAdapter

 

类概述

这个适配器在ExpandableListView和底层数据之间起到了一个衔接的作用。该接口的实现类提供了访问子元素(以组的形式将它们分类)的数据;同样,也提供了为子元素和组创建相应的视图。

 

公共方法

       public abstract boolean areAllItemsEnabled ()

         ExpandableListAdapter里面的所有条目都可用吗?如果是yes,就意味着所有条目可以选择和点击了。

返回值

                            返回True表示所有条目均可用。

                   参见

                            areAllItemsEnabled()

 

public abstract Cursor getChild (int groupPosition, int childPosition)

         获取指定组中的指定子元素数据。

                  参数

                            groupPosition           组位置(该组内部含有子元素)

                            childPosition              子元素位置(相对于其它子元素)

                  返回值

                            返回指定子元素数据。

 

public abstract long getChildId (int groupPosition, int childPosition)

获取指定组中的指定子元素ID,这个ID在组里一定是唯一的。联合ID(参见getCombinedChildId(long, long))在所有条目(所有组和所有元素)中也是唯一的。

                   参数

                            groupPosition           组位置(该组内部含有子元素)

                            childPosition              子元素位置(相对于其它子元素)

                   返回值

                  子元素关联ID

 

         public abstract View getChildView (int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)

         获取一个视图对象,显示指定组中的指定子元素数据。

                  参数

                           groupPosition   组位置(该组内部含有子元素)

                            childPosition    子元素位置(决定返回哪个视图)

                            isLastChild     子元素是否处于组中的最后一个

convertView    重用已有的视图(View)对象。注意:在使用前你应该检查一下这个视图对象是否非空并且这个对象的类型是否合适。由此引伸出,如果该对象不能被转换并显示正确的数据,这个方法就会调用getChildView(int, int, boolean, View, ViewGroup)来创建一个视图(View)对象。

                            parent               返回的视图(View)对象始终依附于的视图组。

                  返回值

                            指定位置上的子元素返回的视图对象

 

public abstract int getChildrenCount (int groupPosition)

         获取指定组中的子元素个数

                   参数

                            groupPosition  组位置(决定返回哪个组的子元素个数)

                   返回值

                            指定组的子元素个数

 

public abstract long getCombinedChildId (long groupId, long childId)

从列表所有项(组或子项)中获得一个唯一的子ID号。可折叠列表要求每个元素(组或子项)在所有的子元素和组中有一个唯一的ID。本方法负责根据所给的子ID号和组ID号返回唯一的ID。此外,若hasStableIds()true,那么必须要返回稳定的ID

                   参数

                            groupId  包含该子元素的组ID

                            childId   子元素的ID

返回值

列表所有项(组或子项)中唯一的(和可能稳定)的子元素ID号。(译者注:ID理论上是稳定的,不会发生冲突的情况。也就是说,这个列表会有组、子元素,它们的ID都是唯一的。

 

public abstract Cursor getGroup (int groupPosition)

获取指定组中的数据

                   参数

                            groupPosition  组位置

                   返回值

                            返回组中的数据,也就是该组中的子元素数据。

 

public abstract int getGroupCount ()

         获取组的个数

                   返回值

                            组的个数

 

         public abstract long getGroupId (int groupPosition)

获取指定组的ID,这个组ID必须是唯一的。联合ID(参见getCombinedGroupId(long))在所有条目(所有组和所有元素)中也是唯一的。

                   参数

                            groupPosition  组位置

                   返回值

                            返回组相关ID

 

public abstract View getGroupView (int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)

         获取显示指定组的视图对象。这个方法仅返回关于组的视图对象,要想获取子元素的视图对象,就需要调用getChildView(int, int, boolean, View, ViewGroup)

         参数

                   groupPosition  组位置(决定返回哪个视图)

                   isExpanded    该组是展开状态还是伸缩状态

convertView   重用已有的视图对象。注意:在使用前你应该检查一下这个视图对象是否非空并且这个对象的类型是否合适。由此引伸出,如果该对象不能被转换并显示正确的数据,这个方法就会调用getGroupView(int, boolean, View, ViewGroup)来创建一个视图(View)对象。

                   parent             返回的视图对象始终依附于的视图组。

         返回值

                   返回指定组的视图对象

 

         public abstract boolean hasStableIds ()

         组和子元素是否持有稳定的ID,也就是底层数据的改变不会影响到它们。

         返回值

返回一个Boolean类型的值,如果为TRUE,意味着相同的ID永远引用相同的对象。

 

         public abstract boolean isChildSelectable (int groupPosition, int childPosition)

         是否选中指定位置上的子元素。

                   参数

                            groupPosition  组位置(该组内部含有这个子元素)

                            childPosition   子元素位置

                   返回值

                  是否选中子元素

 

         public abstract boolean isEmpty ()

                   返回值

如果当前适配器不包含任何数据则返回True。经常用来决定一个空视图是否应该被显示。一个典型的实现将返回表达式getCount() == 0的结果,但是由于getCount()包含了头部和尾部,适配器可能需要不同的行为。

                  参见

                            isEmpty()

 

         public abstract void onGroupCollapsed (int groupPosition)

         当组收缩状态的时候此方法被调用。

                   参数

                            groupPosition  收缩状态的组索引

 

         public abstract void onGroupExpanded (int groupPosition)

         当组展开状态的时候此方法被调用。

                   参数

                            groupPosition  展开状态的组位置

 

         public abstract void registerDataSetObserver (DataSetObserver observer)

         注册一个观察者(observer),当此适配器数据修改时即调用此观察者。

                   参数

                            observer  当数据修改时通知调用的对象。

 

         public abstract void unregisterDataSetObserver (DataSetObserver observer)

取消先前通过registerDataSetObserver(DataSetObserver)方式注册进该适配器中的观         察者对象。

                  参数

                            observer  取消这个观察者的注册

 

补充

         文章精选

                   android 可展开(收缩)的列表ListView(ExpandableListView)

                   android CursorAdapter的监听事件


前の記事: 次の記事: