Build 1.0_r1(from source)

android.widget
Class ExpandableListView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<ListAdapter>
              extended by android.widget.AbsListView
                  extended by android.widget.ListView
                      extended by android.widget.ExpandableListView
All Implemented Interfaces:
Drawable.Callback, TextWatcher, KeyEvent.Callback, ViewManager, ViewParent, ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnTouchModeChangeListener, Filter.FilterListener

public class ExpandableListView
extends ListView

A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.

Expandable lists are able to show an indicator beside each item to display the item's current state (the states are usually one of expanded group, collapsed group, child, or last child). Use setChildIndicator(Drawable) or setGroupIndicator(Drawable) (or the corresponding XML attributes) to set these indicators (see the docs for each method to see additional state that each Drawable can have). The default style for an ExpandableListView provides indicators which will be shown next to Views given to the ExpandableListView. The layouts android.R.layout.simple_expandable_list_item_1 and android.R.layout.simple_expandable_list_item_2 (which should be used with SimpleCursorTreeAdapter) contain the preferred position information for indicators.

The context menu information set by an ExpandableListView will be a ExpandableListView.ExpandableListContextMenuInfo object with ExpandableListView.ExpandableListContextMenuInfo.packedPosition being a packed position that can be used with getPackedPositionType(long) and the other similar methods.

Note: You cannot use the value wrap_content for the android:layout_height attribute of a ExpandableListView in XML if the parent's size is also not strictly specified (for example, if the parent were ScrollView you could not specify wrap_content since it also can be any length. However, you can use wrap_content if the ExpandableListView parent has a specific size, such as 100 pixels.


Nested Class Summary
static class ExpandableListView.ExpandableListContextMenuInfo
          Extra menu information specific to an ExpandableListView provided to the android.view.View.OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when a context menu is brought up for this AdapterView.
static interface ExpandableListView.OnChildClickListener
          Interface definition for a callback to be invoked when a child in this expandable list has been clicked.
static interface ExpandableListView.OnGroupClickListener
          Interface definition for a callback to be invoked when a group in this expandable list has been clicked.
static interface ExpandableListView.OnGroupCollapseListener
          Used for being notified when a group is collapsed
static interface ExpandableListView.OnGroupExpandListener
          Used for being notified when a group is expanded
(package private) static class ExpandableListView.SavedState
           
 
Nested classes/interfaces inherited from class android.widget.ListView
ListView.FixedViewInfo
 
Nested classes/interfaces inherited from class android.widget.AbsListView
AbsListView.CheckForTap, AbsListView.LayoutParams, AbsListView.OnScrollListener, AbsListView.RecycleBin, AbsListView.RecyclerListener
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.AdapterDataSetObserver, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Field Summary
static int CHILD_INDICATOR_INHERIT
          Denotes when a child indicator should inherit this bound from the generic indicator bounds
static int PACKED_POSITION_TYPE_CHILD
          The packed position represents a child.
static int PACKED_POSITION_TYPE_GROUP
          The packed position represents a group.
static int PACKED_POSITION_TYPE_NULL
          The packed position represents a neither/null/no preference.
static long PACKED_POSITION_VALUE_NULL
          The value for a packed position that represents neither/null/no preference.
 
Fields inherited from class android.widget.ListView
CHOICE_MODE_MULTIPLE, CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, mDivider, mDividerHeight, NO_POSITION
 
Fields inherited from class android.widget.AbsListView
LAYOUT_FORCE_BOTTOM, LAYOUT_FORCE_TOP, LAYOUT_MOVE_SELECTION, LAYOUT_NORMAL, LAYOUT_SET_SELECTION, LAYOUT_SPECIFIC, LAYOUT_SYNC, mCachingStarted, mDataSetObserver, mDrawSelectorOnTop, mLastY, mLayoutMode, mListPadding, mMotionCorrection, mMotionPosition, mMotionViewNewTop, mMotionViewOriginalTop, mMotionX, mMotionY, mPopup, mRecycler, mResurrectToPosition, mScrollDown, mScrollingCacheEnabled, mScrollUp, mSelectedTop, mSelectionBottomPadding, mSelectionLeftPadding, mSelectionRightPadding, mSelectionTopPadding, mSelector, mSelectorRect, mStackFromBottom, mTextFilter, mTouchMode, mWidthMeasureSpec, TOUCH_MODE_DONE_WAITING, TOUCH_MODE_DOWN, TOUCH_MODE_FLING, TOUCH_MODE_REST, TOUCH_MODE_SCROLL, TOUCH_MODE_TAP, TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
 
Fields inherited from class android.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE, mBlockLayoutRequests, mDataChanged, mEmptyView, mFirstPosition, mInLayout, mItemCount, mNeedSync, mNextSelectedPosition, mNextSelectedRowId, mOldItemCount, mOldSelectedPosition, mOldSelectedRowId, mOnItemClickListener, mOnItemLongClickListener, mOnItemSelectedListener, mSelectedPosition, mSelectedRowId, mSpecificTop, mSyncHeight, mSyncMode, mSyncPosition, mSyncRowId, SYNC_FIRST_POSITION, SYNC_MAX_DURATION_MILLIS, SYNC_SELECTED_POSITION
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
ExpandableListView(Context context)
           
ExpandableListView(Context context, AttributeSet attrs)
           
ExpandableListView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 boolean collapseGroup(int groupPos)
          Collapse a group in the grouped list view
(package private)  ContextMenu.ContextMenuInfo createContextMenuInfo(View view, int flatListPosition, long id)
          Creates the ContextMenuInfo returned from AbsListView.getContextMenuInfo().
protected  void dispatchDraw(Canvas canvas)
          Called by draw to draw the child views.
(package private)  void drawDivider(Canvas canvas, Rect bounds, int childIndex)
          Draws a divider for the given child in the given bounds.
 boolean expandGroup(int groupPos)
          Expand a group in the grouped list view
 ListAdapter getAdapter()
          This method should not be used, use getExpandableListAdapter().
 ExpandableListAdapter getExpandableListAdapter()
          Gets the adapter that provides data to this view.
 long getExpandableListPosition(int flatListPosition)
          Converts a flat list position (the raw position of an item (child or group) in the list) to an group and/or child position (represented in a packed position).
 int getFlatListPosition(long packedPosition)
          Converts a group and/or child position to a flat list position.
static int getPackedPositionChild(long packedPosition)
          Gets the child position from a packed position that is of PACKED_POSITION_TYPE_CHILD type (use getPackedPositionType(long)).
static long getPackedPositionForChild(int groupPosition, int childPosition)
          Returns the packed position representation of a child's position.
static long getPackedPositionForGroup(int groupPosition)
          Returns the packed position representation of a group's position.
static int getPackedPositionGroup(long packedPosition)
          Gets the group position from a packed position.
static int getPackedPositionType(long packedPosition)
          Gets the type of a packed position.
 long getSelectedId()
          Gets the ID of the currently selected group or child.
 long getSelectedPosition()
          Gets the position of the currently selected group or child (along with its type).
(package private)  boolean handleItemClick(View v, int position, long id)
          This will either expand/collapse groups (if a group was clicked) or pass on the click to the proper child (if a child was clicked)
 boolean isGroupExpanded(int groupPosition)
          Whether the given group is currently expanded.
 void onRestoreInstanceState(Parcelable state)
          Hook allowing a view to re-apply a representation of its internal state that had previously been generated by View.onSaveInstanceState().
 Parcelable onSaveInstanceState()
          Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
 boolean performItemClick(View v, int position, long id)
          Call the OnItemClickListener, if it is defined.
 void setAdapter(ExpandableListAdapter adapter)
          Sets the adapter that provides data to this view.
 void setAdapter(ListAdapter adapter)
          This overloaded method should not be used, instead use setAdapter(ExpandableListAdapter).
 void setChildDivider(Drawable childDivider)
          Sets the drawable that will be drawn adjacent to every child in the list.
 void setChildIndicator(Drawable childIndicator)
          Sets the indicator to be drawn next to a child.
 void setChildIndicatorBounds(int left, int right)
          Sets the drawing bounds for the child indicator.
 void setGroupIndicator(Drawable groupIndicator)
          Sets the indicator to be drawn next to a group.
 void setIndicatorBounds(int left, int right)
          Sets the drawing bounds for the indicators (at minimum, the group indicator is affected by this; the child indicator is affected by this if the child indicator bounds are set to inherit).
 void setOnChildClickListener(ExpandableListView.OnChildClickListener onChildClickListener)
           
 void setOnGroupClickListener(ExpandableListView.OnGroupClickListener onGroupClickListener)
           
 void setOnGroupCollapseListener(ExpandableListView.OnGroupCollapseListener onGroupCollapseListener)
           
 void setOnGroupExpandListener(ExpandableListView.OnGroupExpandListener onGroupExpandListener)
           
 void setOnItemClickListener(AdapterView.OnItemClickListener l)
          Register a callback to be invoked when an item has been clicked and the caller prefers to receive a ListView-style position instead of a group and/or child position.
 boolean setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup)
          Sets the selection to the specified child.
 void setSelectedGroup(int groupPosition)
          Sets the selection to the specified group.
 
Methods inherited from class android.widget.ListView
addFooterView, addFooterView, addHeaderView, addHeaderView, arrowScroll, canAnimate, clearChoices, dispatchKeyEvent, fillGap, findMotionRow, findViewInHeadersOrFooters, findViewTagInHeadersOrFooters, findViewTraversal, findViewWithTagTraversal, fullScroll, getCheckedItemPosition, getCheckedItemPositions, getChoiceMode, getDivider, getDividerHeight, getFooterViewsCount, getHeaderViewsCount, getItemsCanFocus, getMaxScrollAmount, isItemChecked, layoutChildren, lookForSelectablePosition, measureHeightOfChildren, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyUp, onMeasure, onTouchEvent, pageScroll, removeFooterView, removeHeaderView, requestChildRectangleOnScreen, resetList, setChoiceMode, setDivider, setDividerHeight, setItemChecked, setItemsCanFocus, setSelection, setSelectionAfterHeaderView, setSelectionFromTop, setSelectionInt
 
Methods inherited from class android.widget.AbsListView
addTouchables, afterTextChanged, beforeTextChanged, checkLayoutParams, clearTextFilter, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, dismissPopup, dispatchSetPressed, drawableStateChanged, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getCacheColorHint, getContextMenuInfo, getDistance, getFocusedRect, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getSelectedView, getSelector, getSolidColor, getTopFadingEdgeStrength, getTranscriptMode, handleDataChanged, hasTextFilter, hideSelector, invalidateViews, invokeOnItemScrollListener, isInFilterMode, isScrollingCacheEnabled, isStackFromBottom, isTextFilterEnabled, keyPressed, obtainView, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onFilterComplete, onGlobalLayout, onInterceptTouchEvent, onLayout, onSizeChanged, onTextChanged, onTouchModeChanged, onWindowFocusChanged, pointToPosition, pointToRowId, positionSelector, reclaimViews, reconcileSelectedPosition, requestLayout, requestLayoutIfNecessary, resurrectSelection, sendToTextFilter, setCacheColorHint, setDrawSelectorOnTop, setFilterText, setOnScrollListener, setRecyclerListener, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, shouldShowSelector, showContextMenuForChild, touchModeDrawsInPressedState, trackMotionScroll, updateScrollIndicators, verifyDrawable
 
Methods inherited from class android.widget.AdapterView
addView, addView, addView, addView, checkFocus, checkSelectionChanged, dispatchRestoreInstanceState, dispatchSaveInstanceState, findSyncPosition, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, rememberSyncState, removeAllViews, removeView, removeViewAt, selectionChanged, setEmptyView, setFocusable, setFocusableInTouchMode, setNextSelectedPositionInt, setOnClickListener, setOnItemLongClickListener, setOnItemSelectedListener, setSelectedPositionInt
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFreezeSelfOnly, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCreateContextMenu, onDraw, onKeyShortcut, onScrollChanged, onSetAlpha, onTrackballEvent, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested
 

Field Detail

PACKED_POSITION_TYPE_GROUP

public static final int PACKED_POSITION_TYPE_GROUP
The packed position represents a group.

See Also:
Constant Field Values

PACKED_POSITION_TYPE_CHILD

public static final int PACKED_POSITION_TYPE_CHILD
The packed position represents a child.

See Also:
Constant Field Values

PACKED_POSITION_TYPE_NULL

public static final int PACKED_POSITION_TYPE_NULL
The packed position represents a neither/null/no preference.

See Also:
Constant Field Values

PACKED_POSITION_VALUE_NULL

public static final long PACKED_POSITION_VALUE_NULL
The value for a packed position that represents neither/null/no preference. This value is not otherwise possible since a group type (first bit 0) should not have a child position filled.

See Also:
Constant Field Values

CHILD_INDICATOR_INHERIT

public static final int CHILD_INDICATOR_INHERIT
Denotes when a child indicator should inherit this bound from the generic indicator bounds

See Also:
Constant Field Values
Constructor Detail

ExpandableListView

public ExpandableListView(Context context)

ExpandableListView

public ExpandableListView(Context context,
                          AttributeSet attrs)

ExpandableListView

public ExpandableListView(Context context,
                          AttributeSet attrs,
                          int defStyle)
Method Detail

dispatchDraw

protected void dispatchDraw(Canvas canvas)
Description copied from class: ViewGroup
Called by draw to draw the child views. This may be overridden by derived classes to gain control just before its children are drawn (but after its own view has been drawn).

Overrides:
dispatchDraw in class ListView
Parameters:
canvas - the canvas on which to draw the view

setChildDivider

public void setChildDivider(Drawable childDivider)
Sets the drawable that will be drawn adjacent to every child in the list. This will be drawn using the same height as the normal divider (ListView.setDivider(Drawable)) or if it does not have an intrinsic height, the height set by ListView.setDividerHeight(int).

Parameters:
childDivider - The drawable to use.

drawDivider

void drawDivider(Canvas canvas,
                 Rect bounds,
                 int childIndex)
Description copied from class: ListView
Draws a divider for the given child in the given bounds.

Overrides:
drawDivider in class ListView
Parameters:
canvas - The canvas to draw to.
bounds - The bounds of the divider.
childIndex - The index of child (of the View) above the divider. This will be -1 if there is no child above the divider to be drawn.

setAdapter

public void setAdapter(ListAdapter adapter)
This overloaded method should not be used, instead use setAdapter(ExpandableListAdapter).

Sets the data behind this ListView. The adapter passed to this method may be wrapped by a WrapperListAdapter, depending on the ListView features currently in use. For instance, adding headers and/or footers will cause the adapter to be wrapped.

Overrides:
setAdapter in class ListView
Parameters:
adapter - The ListAdapter which is responsible for maintaining the data backing this list and for producing a view to represent an item in that data set.
See Also:
ListView.getAdapter()

getAdapter

public ListAdapter getAdapter()
This method should not be used, use getExpandableListAdapter().

Overrides:
getAdapter in class ListView
Returns:
The adapter currently used to display data in this ListView.
See Also:
ListView.setAdapter(ListAdapter)

setOnItemClickListener

public void setOnItemClickListener(AdapterView.OnItemClickListener l)
Register a callback to be invoked when an item has been clicked and the caller prefers to receive a ListView-style position instead of a group and/or child position. In most cases, the caller should use setOnGroupClickListener(android.widget.ExpandableListView.OnGroupClickListener) and/or setOnChildClickListener(android.widget.ExpandableListView.OnChildClickListener).

Register a callback to be invoked when an item in this AdapterView has been clicked.

Overrides:
setOnItemClickListener in class AdapterView<ListAdapter>
Parameters:
l - The callback that will be invoked.

setAdapter

public void setAdapter(ExpandableListAdapter adapter)
Sets the adapter that provides data to this view.

Parameters:
adapter - The adapter that provides data to this view.

getExpandableListAdapter

public ExpandableListAdapter getExpandableListAdapter()
Gets the adapter that provides data to this view.

Returns:
The adapter that provides data to this view.

performItemClick

public boolean performItemClick(View v,
                                int position,
                                long id)
Description copied from class: AdapterView
Call the OnItemClickListener, if it is defined.

Overrides:
performItemClick in class ListView
Parameters:
v - The view within the AdapterView that was clicked.
position - The position of the view in the adapter.
id - The row id of the item that was clicked.
Returns:
True if there was an assigned OnItemClickListener that was called, false otherwise is returned.

handleItemClick

boolean handleItemClick(View v,
                        int position,
                        long id)
This will either expand/collapse groups (if a group was clicked) or pass on the click to the proper child (if a child was clicked)

Parameters:
position - The flat list position. This has already been factored to remove the header/footer.
id - The ListAdapter ID, not the group or child ID.

expandGroup

public boolean expandGroup(int groupPos)
Expand a group in the grouped list view

Parameters:
groupPos - the group to be expanded
Returns:
True if the group was expanded, false otherwise (if the group was already expanded, this will return false)

collapseGroup

public boolean collapseGroup(int groupPos)
Collapse a group in the grouped list view

Parameters:
groupPos - position of the group to collapse
Returns:
True if the group was collapsed, false otherwise (if the group was already collapsed, this will return false)

setOnGroupCollapseListener

public void setOnGroupCollapseListener(ExpandableListView.OnGroupCollapseListener onGroupCollapseListener)

setOnGroupExpandListener

public void setOnGroupExpandListener(ExpandableListView.OnGroupExpandListener onGroupExpandListener)

setOnGroupClickListener

public void setOnGroupClickListener(ExpandableListView.OnGroupClickListener onGroupClickListener)

setOnChildClickListener

public void setOnChildClickListener(ExpandableListView.OnChildClickListener onChildClickListener)

getExpandableListPosition

public long getExpandableListPosition(int flatListPosition)
Converts a flat list position (the raw position of an item (child or group) in the list) to an group and/or child position (represented in a packed position). This is useful in situations where the caller needs to use the underlying ListView's methods. Use getPackedPositionType(long) , getPackedPositionChild(long), getPackedPositionGroup(long) to unpack.

Parameters:
flatListPosition - The flat list position to be converted.
Returns:
The group and/or child position for the given flat list position in packed position representation.

getFlatListPosition

public int getFlatListPosition(long packedPosition)
Converts a group and/or child position to a flat list position. This is useful in situations where the caller needs to use the underlying ListView's methods.

Parameters:
packedPosition - The group and/or child positions to be converted in packed position representation. Use getPackedPositionForChild(int, int) or getPackedPositionForGroup(int).
Returns:
The flat list position for the given child or group.

getSelectedPosition

public long getSelectedPosition()
Gets the position of the currently selected group or child (along with its type). Can return PACKED_POSITION_VALUE_NULL if no selection.

Returns:
A packed position containing the currently selected group or child's position and type. #PACKED_POSITION_VALUE_NULL if no selection.

getSelectedId

public long getSelectedId()
Gets the ID of the currently selected group or child. Can return -1 if no selection.

Returns:
The ID of the currently selected group or child. -1 if no selection.

setSelectedGroup

public void setSelectedGroup(int groupPosition)
Sets the selection to the specified group.

Parameters:
groupPosition - The position of the group that should be selected.

setSelectedChild

public boolean setSelectedChild(int groupPosition,
                                int childPosition,
                                boolean shouldExpandGroup)
Sets the selection to the specified child. If the child is in a collapsed group, the group will only be expanded and child subsequently selected if shouldExpandGroup is set to true, otherwise the method will return false.

Parameters:
groupPosition - The position of the group that contains the child.
childPosition - The position of the child within the group.
shouldExpandGroup - Whether the child's group should be expanded if it is collapsed.
Returns:
Whether the selection was successfully set on the child.

isGroupExpanded

public boolean isGroupExpanded(int groupPosition)
Whether the given group is currently expanded.

Parameters:
groupPosition - The group to check.
Returns:
Whether the group is currently expanded.

getPackedPositionType

public static int getPackedPositionType(long packedPosition)
Gets the type of a packed position. See getPackedPositionForChild(int, int).

Parameters:
packedPosition - The packed position for which to return the type.
Returns:
The type of the position contained within the packed position, either PACKED_POSITION_TYPE_CHILD, PACKED_POSITION_TYPE_GROUP, or PACKED_POSITION_TYPE_NULL.

getPackedPositionGroup

public static int getPackedPositionGroup(long packedPosition)
Gets the group position from a packed position. See getPackedPositionForChild(int, int).

Parameters:
packedPosition - The packed position from which the group position will be returned.
Returns:
The group position portion of the packed position. If this does not contain a group, returns -1.

getPackedPositionChild

public static int getPackedPositionChild(long packedPosition)
Gets the child position from a packed position that is of PACKED_POSITION_TYPE_CHILD type (use getPackedPositionType(long)). To get the group that this child belongs to, use getPackedPositionGroup(long). See getPackedPositionForChild(int, int).

Parameters:
packedPosition - The packed position from which the child position will be returned.
Returns:
The child position portion of the packed position. If this does not contain a child, returns -1.

getPackedPositionForChild

public static long getPackedPositionForChild(int groupPosition,
                                             int childPosition)
Returns the packed position representation of a child's position.

In general, a packed position should be used in situations where the position given to/returned from an ExpandableListAdapter or ExpandableListView method can either be a child or group. The two positions are packed into a single long which can be unpacked using getPackedPositionChild(long), getPackedPositionGroup(long), and getPackedPositionType(long).

Parameters:
groupPosition - The child's parent group's position.
childPosition - The child position within the group.
Returns:
The packed position representation of the child (and parent group).

getPackedPositionForGroup

public static long getPackedPositionForGroup(int groupPosition)
Returns the packed position representation of a group's position. See getPackedPositionForChild(int, int).

Parameters:
groupPosition - The child's parent group's position.
Returns:
The packed position representation of the group.

createContextMenuInfo

ContextMenu.ContextMenuInfo createContextMenuInfo(View view,
                                                  int flatListPosition,
                                                  long id)
Description copied from class: AbsListView
Creates the ContextMenuInfo returned from AbsListView.getContextMenuInfo(). This methods knows the view, position and ID of the item that received the long press.

Overrides:
createContextMenuInfo in class AbsListView
Parameters:
view - The view that received the long press.
flatListPosition - The position of the item that received the long press.
id - The ID of the item that received the long press.
Returns:
The extra information that should be returned by AbsListView.getContextMenuInfo().

setChildIndicator

public void setChildIndicator(Drawable childIndicator)
Sets the indicator to be drawn next to a child.

Parameters:
childIndicator - The drawable to be used as an indicator. If the child is the last child for a group, the state R.attr.state_last will be set.

setChildIndicatorBounds

public void setChildIndicatorBounds(int left,
                                    int right)
Sets the drawing bounds for the child indicator. For either, you can specify CHILD_INDICATOR_INHERIT to use inherit from the general indicator's bounds.

Parameters:
left - The left position (relative to the left bounds of this View) to start drawing the indicator.
right - The right position (relative to the left bounds of this View) to end the drawing of the indicator.
See Also:
setIndicatorBounds(int, int)

setGroupIndicator

public void setGroupIndicator(Drawable groupIndicator)
Sets the indicator to be drawn next to a group.

Parameters:
groupIndicator - The drawable to be used as an indicator. If the group is empty, the state R.attr.state_empty will be set. If the group is expanded, the state R.attr.state_expanded will be set.

setIndicatorBounds

public void setIndicatorBounds(int left,
                               int right)
Sets the drawing bounds for the indicators (at minimum, the group indicator is affected by this; the child indicator is affected by this if the child indicator bounds are set to inherit).

Parameters:
left - The left position (relative to the left bounds of this View) to start drawing the indicator.
right - The right position (relative to the left bounds of this View) to end the drawing of the indicator.
See Also:
setChildIndicatorBounds(int, int)

onSaveInstanceState

public Parcelable onSaveInstanceState()
Description copied from class: View
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.

Overrides:
onSaveInstanceState in class ListView
Returns:
Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.
See Also:
View.onRestoreInstanceState(android.os.Parcelable), View.saveHierarchyState(android.util.SparseArray), View.dispatchSaveInstanceState(android.util.SparseArray), View.setSaveEnabled(boolean)

onRestoreInstanceState

public void onRestoreInstanceState(Parcelable state)
Description copied from class: View
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by View.onSaveInstanceState(). This function will never be called with a null state.

Overrides:
onRestoreInstanceState in class ListView
Parameters:
state - The frozen state that had previously been returned by View.onSaveInstanceState().
See Also:
View.onSaveInstanceState(), View.restoreHierarchyState(android.util.SparseArray), View.dispatchRestoreInstanceState(android.util.SparseArray)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature