public class ExpandableListView extends ListView
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.
Modifier and Type | Class and Description |
---|---|
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
|
ListView.FixedViewInfo
AbsListView.LayoutParams, AbsListView.MultiChoiceModeListener, AbsListView.OnScrollListener, AbsListView.RecyclerListener, AbsListView.SelectionBoundsAdjuster
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener
NoCopySpan.Concrete
Modifier and Type | Field and Description |
---|---|
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.
|
CHOICE_MODE_MULTIPLE, CHOICE_MODE_MULTIPLE_MODAL, CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
CLIP_BOUNDS, CLIP_TO_PADDING_MASK, FLAG_DISALLOW_INTERCEPT, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ALPHA, DEBUG_LAYOUT_PROPERTY, DRAG_FLAG_GLOBAL, 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, FIND_VIEWS_WITH_ACCESSIBILITY_NODE_PROVIDERS, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, mBottom, mCachingFailed, mContext, mCurrentAnimation, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mInputEventConsistencyVerifier, mLayoutParams, mLeft, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, mUserPaddingBottom, mUserPaddingLeft, mUserPaddingRight, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, 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_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, PUBLIC_STATUS_BAR_VISIBILITY_MASK, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_DISABLE_BACK, STATUS_BAR_DISABLE_CLOCK, STATUS_BAR_DISABLE_EXPAND, STATUS_BAR_DISABLE_HOME, STATUS_BAR_DISABLE_NOTIFICATION_ALERTS, STATUS_BAR_DISABLE_NOTIFICATION_ICONS, STATUS_BAR_DISABLE_NOTIFICATION_TICKER, STATUS_BAR_DISABLE_RECENT, STATUS_BAR_DISABLE_SEARCH, STATUS_BAR_DISABLE_SYSTEM_INFO, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_CLEARABLE_FLAGS, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
Constructor and Description |
---|
ExpandableListView(Context context) |
ExpandableListView(Context context,
AttributeSet attrs) |
ExpandableListView(Context context,
AttributeSet attrs,
int defStyle) |
Modifier and Type | Method and Description |
---|---|
boolean |
collapseGroup(int groupPos)
Collapse a group in the grouped list view
|
protected void |
dispatchDraw(Canvas canvas)
Called by draw to draw the child views.
|
boolean |
expandGroup(int groupPos)
Expand a group in the grouped list view
|
boolean |
expandGroup(int groupPos,
boolean animate)
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 a 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).
|
boolean |
isGroupExpanded(int groupPosition)
Whether the given group is currently expanded.
|
void |
onInitializeAccessibilityEvent(AccessibilityEvent event)
Initializes an
AccessibilityEvent with information about
this View which is the event source. |
void |
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
Initializes an
AccessibilityNodeInfo with information about this view. |
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.
|
addFooterView, addFooterView, addHeaderView, addHeaderView, canAnimate, dispatchKeyEvent, drawChild, findViewByPredicateTraversal, findViewTraversal, findViewWithTagTraversal, getCheckItemIds, getDivider, getDividerHeight, getFooterViewsCount, getHeaderViewsCount, getItemsCanFocus, getMaxScrollAmount, getOverscrollFooter, getOverscrollHeader, isOpaque, layoutChildren, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyUp, onMeasure, onSizeChanged, recycleOnMeasure, removeFooterView, removeHeaderView, requestChildRectangleOnScreen, setCacheColorHint, setDivider, setDividerHeight, setFooterDividersEnabled, setHeaderDividersEnabled, setItemsCanFocus, setOverscrollFooter, setOverscrollHeader, setRemoteViewsAdapter, setSelection, setSelectionAfterHeaderView, setSelectionFromTop, smoothScrollByOffset, smoothScrollToPosition
addTouchables, afterTextChanged, beforeTextChanged, checkInputConnectionProxy, checkLayoutParams, clearChoices, clearTextFilter, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, deferNotifyDataSetChanged, dispatchSetPressed, draw, drawableStateChanged, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCacheColorHint, getCheckedItemCount, getCheckedItemIds, getCheckedItemPosition, getCheckedItemPositions, getChoiceMode, getContextMenuInfo, getFocusedRect, getLeftPaddingOffset, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getRightPaddingOffset, getSelectedView, getSelector, getSolidColor, getTextFilter, getTopFadingEdgeStrength, getTopPaddingOffset, getTranscriptMode, getVerticalScrollbarWidth, handleDataChanged, hasTextFilter, invalidateViews, isFastScrollAlwaysVisible, isFastScrollEnabled, isInFilterMode, isItemChecked, isPaddingOffsetRequired, isScrollingCacheEnabled, isSmoothScrollbarEnabled, isStackFromBottom, isTextFilterEnabled, isVerticalScrollBarHidden, jumpDrawablesToCurrentState, onAttachedToWindow, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onDisplayHint, onFilterComplete, onGenericMotionEvent, onGlobalLayout, onInterceptTouchEvent, onLayout, onOverScrolled, onRemoteAdapterConnected, onRemoteAdapterDisconnected, onTextChanged, onTouchEvent, onTouchModeChanged, onWindowFocusChanged, performAccessibilityAction, pointToPosition, pointToRowId, reclaimViews, requestDisallowInterceptTouchEvent, requestLayout, sendAccessibilityEvent, setChoiceMode, setDrawSelectorOnTop, setFastScrollAlwaysVisible, setFastScrollEnabled, setFilterText, setFrame, setFriction, setItemChecked, setMultiChoiceModeListener, setOnScrollListener, setOverScrollEffectPadding, setOverScrollMode, setRecyclerListener, setRemoteViewsOnClickHandler, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, setVelocityScale, setVerticalScrollbarPosition, showContextMenu, showContextMenuForChild, smoothScrollBy, smoothScrollToPosition, smoothScrollToPositionFromTop, smoothScrollToPositionFromTop, verifyDrawable
addView, addView, addView, addView, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, onRequestSendAccessibilityEvent, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemLongClickListener, setOnItemSelectedListener
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childAccessibilityStateChanged, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchGetDisplayList, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findViewsWithText, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getPersistentDrawingCache, hasFocus, hasFocusable, hasHoveredChild, hasTransientState, indexOfChild, internalSetPadding, invalidateChild, invalidateChildFast, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransformedTouchPointInView, layout, makeOptionalFitsSystemWindows, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onChildVisibilityChanged, onDebugDraw, onDebugDrawMargins, onInterceptHoverEvent, onRequestFocusInDescendants, onSetLayoutParams, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestFocus, requestSendAccessibilityEvent, requestTransitionStart, requestTransparentRegion, resetAccessibilityStateChanged, resetResolvedDrawables, resetResolvedLayoutDirection, resetResolvedPadding, resetResolvedTextAlignment, resetResolvedTextDirection, resetRtlProperties, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, shouldDelayChildPressedState, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, applyDrawableToTransparentRegion, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canHaveDisplayList, canResolveLayoutDirection, canScrollHorizontally, canScrollVertically, clearAccessibilityFocus, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeOpaqueFlags, computeScroll, createAccessibilityNodeInfo, createContextMenu, debug, debugIndent, destroyDrawingCache, destroyHardwareResources, dispatchGenericMotionEvent, dispatchPointerEvent, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewWithTag, fitsSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityCursorPosition, getAccessibilityDelegate, getAccessibilityNodeProvider, getAccessibilityViewId, getAccessibilityWindowId, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getCameraDistance, getContentDescription, getContext, getDefaultSize, getDisplay, getDisplayList, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFadeHeight, getFadeTop, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHardwareRenderer, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollFactor, getId, getImportantForAccessibility, getIterableTextForAccessibility, getIteratorForGranularity, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOpticalInsets, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getResources, getRight, getRightFadingEdgeStrength, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollFactor, getViewRootImpl, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hackTurnOffWindowResizeAnim, hasOnClickListeners, hasOpaqueScrollbars, hasOverlappingRendering, hasWindowFocus, includeForAccessibility, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, invalidateParentCaches, invalidateParentIfNeeded, isActionableForAccessibility, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInScrollingContainer, isInTouchMode, isLayoutDirectionInherited, isLayoutRequested, isLayoutRtl, isLongClickable, isPaddingRelative, isPressed, isRootNamespace, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentInherited, isTextDirectionInherited, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUser, isVisibleToUser, measure, mergeDrawableStates, notifyAccessibilityStateChanged, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCloseSystemDialogs, onConfigurationChanged, onCreateContextMenu, onDragEvent, onDraw, onDrawHorizontalScrollBar, onDrawScrollBars, onDrawVerticalScrollBar, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onFocusLost, onHoverChanged, onHoverEvent, onKeyLongPress, onKeyPreIme, onKeyShortcut, onPopulateAccessibilityEvent, onResolveDrawables, onRtlPropertiesChanged, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, outputDirtyFlags, overScrollBy, performButtonActionOnTouchDown, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, recomputePadding, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestAccessibilityFocus, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resetPaddingToInitialValues, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEventUnchecked, setAccessibilityCursorPosition, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDisabledSystemUiVisibility, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setIsRootNamespace, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutInsets, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTagInternal, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createContextMenu, getParent, getParentForAccessibility, isLayoutRequested, requestFitSystemWindows
public static final int PACKED_POSITION_TYPE_GROUP
public static final int PACKED_POSITION_TYPE_CHILD
public static final int PACKED_POSITION_TYPE_NULL
public static final long PACKED_POSITION_VALUE_NULL
public static final int CHILD_INDICATOR_INHERIT
public ExpandableListView(Context context)
public ExpandableListView(Context context, AttributeSet attrs)
public ExpandableListView(Context context, AttributeSet attrs, int defStyle)
protected void dispatchDraw(Canvas canvas)
ViewGroup
dispatchDraw
in class ListView
canvas
- the canvas on which to draw the viewpublic void setChildDivider(Drawable childDivider)
ListView.setDivider(Drawable)
) or
if it does not have an intrinsic height, the height set by ListView.setDividerHeight(int)
.childDivider
- The drawable to use.public void setAdapter(ListAdapter adapter)
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.
setAdapter
in class ListView
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.ListView.getAdapter()
public ListAdapter getAdapter()
getExpandableListAdapter()
.getAdapter
in class ListView
ListView.setAdapter(ListAdapter)
public void setOnItemClickListener(AdapterView.OnItemClickListener l)
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.setOnItemClickListener
in class AdapterView<ListAdapter>
l
- The callback that will be invoked.public void setAdapter(ExpandableListAdapter adapter)
adapter
- The adapter that provides data to this view.public ExpandableListAdapter getExpandableListAdapter()
public boolean performItemClick(View v, int position, long id)
AdapterView
performItemClick
in class AbsListView
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.public boolean expandGroup(int groupPos)
groupPos
- the group to be expandedpublic boolean expandGroup(int groupPos, boolean animate)
groupPos
- the group to be expandedanimate
- true if the expanding group should be animated inpublic boolean collapseGroup(int groupPos)
groupPos
- position of the group to collapsepublic void setOnGroupCollapseListener(ExpandableListView.OnGroupCollapseListener onGroupCollapseListener)
public void setOnGroupExpandListener(ExpandableListView.OnGroupExpandListener onGroupExpandListener)
public void setOnGroupClickListener(ExpandableListView.OnGroupClickListener onGroupClickListener)
public void setOnChildClickListener(ExpandableListView.OnChildClickListener onChildClickListener)
public long getExpandableListPosition(int flatListPosition)
ListView
's methods. Use
getPackedPositionType(long)
,
getPackedPositionChild(long)
,
getPackedPositionGroup(long)
to unpack.flatListPosition
- The flat list position to be converted.public int getFlatListPosition(long packedPosition)
ListView
's methods.packedPosition
- The group and/or child positions to be converted in
packed position representation. Use
getPackedPositionForChild(int, int)
or
getPackedPositionForGroup(int)
.public long getSelectedPosition()
PACKED_POSITION_VALUE_NULL
if no selection.public long getSelectedId()
public void setSelectedGroup(int groupPosition)
groupPosition
- The position of the group that should be selected.public boolean setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup)
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.public boolean isGroupExpanded(int groupPosition)
groupPosition
- The group to check.public static int getPackedPositionType(long packedPosition)
getPackedPositionForChild(int, int)
.packedPosition
- The packed position for which to return the type.PACKED_POSITION_TYPE_CHILD
, PACKED_POSITION_TYPE_GROUP
, or
PACKED_POSITION_TYPE_NULL
.public static int getPackedPositionGroup(long packedPosition)
getPackedPositionForChild(int, int)
.packedPosition
- The packed position from which the group position
will be returned.public static int getPackedPositionChild(long packedPosition)
PACKED_POSITION_TYPE_CHILD
type (use getPackedPositionType(long)
).
To get the group that this child belongs to, use
getPackedPositionGroup(long)
. See
getPackedPositionForChild(int, int)
.packedPosition
- The packed position from which the child position
will be returned.public static long getPackedPositionForChild(int groupPosition, int childPosition)
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)
.
groupPosition
- The child's parent group's position.childPosition
- The child position within the group.public static long getPackedPositionForGroup(int groupPosition)
getPackedPositionForChild(int, int)
.groupPosition
- The child's parent group's position.public void setChildIndicator(Drawable childIndicator)
childIndicator
- The drawable to be used as an indicator. If the
child is the last child for a group, the state
android.R.attr#state_last
will be set.public void setChildIndicatorBounds(int left, int right)
CHILD_INDICATOR_INHERIT
to use inherit from the general
indicator's bounds.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.setIndicatorBounds(int, int)
public void setGroupIndicator(Drawable groupIndicator)
groupIndicator
- The drawable to be used as an indicator. If the
group is empty, the state android.R.attr#state_empty
will be
set. If the group is expanded, the state
android.R.attr#state_expanded
will be set.public void setIndicatorBounds(int left, int right)
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.setChildIndicatorBounds(int, int)
public Parcelable onSaveInstanceState()
View
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.
onSaveInstanceState
in class AbsListView
View.onRestoreInstanceState(android.os.Parcelable)
,
View.saveHierarchyState(android.util.SparseArray)
,
View.dispatchSaveInstanceState(android.util.SparseArray)
,
View.setSaveEnabled(boolean)
public void onRestoreInstanceState(Parcelable state)
View
View.onSaveInstanceState()
. This function will never be called with a
null state.onRestoreInstanceState
in class AbsListView
state
- The frozen state that had previously been returned by
View.onSaveInstanceState()
.View.onSaveInstanceState()
,
View.restoreHierarchyState(android.util.SparseArray)
,
View.dispatchRestoreInstanceState(android.util.SparseArray)
public void onInitializeAccessibilityEvent(AccessibilityEvent event)
View
AccessibilityEvent
with information about
this View which is the event source. In other words, the source of
an accessibility event is the view whose state change triggered firing
the event.
Example: Setting the password property of an event in addition to properties set by the super implementation:
public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setPassword(true); }
If an View.AccessibilityDelegate
has been specified via calling
View.setAccessibilityDelegate(AccessibilityDelegate)
its
View.AccessibilityDelegate.onInitializeAccessibilityEvent(View, AccessibilityEvent)
is responsible for handling this call.
Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.
onInitializeAccessibilityEvent
in class ListView
event
- The event to initialize.View.sendAccessibilityEvent(int)
,
View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
View
AccessibilityNodeInfo
with information about this view.
The base implementation sets:
AccessibilityNodeInfo.setParent(View)
,AccessibilityNodeInfo.setBoundsInParent(Rect)
,AccessibilityNodeInfo.setBoundsInScreen(Rect)
,AccessibilityNodeInfo.setPackageName(CharSequence)
,AccessibilityNodeInfo.setClassName(CharSequence)
,AccessibilityNodeInfo.setContentDescription(CharSequence)
,AccessibilityNodeInfo.setEnabled(boolean)
,AccessibilityNodeInfo.setClickable(boolean)
,AccessibilityNodeInfo.setFocusable(boolean)
,AccessibilityNodeInfo.setFocused(boolean)
,AccessibilityNodeInfo.setLongClickable(boolean)
,AccessibilityNodeInfo.setSelected(boolean)
,Subclasses should override this method, call the super implementation, and set additional attributes.
If an View.AccessibilityDelegate
has been specified via calling
View.setAccessibilityDelegate(AccessibilityDelegate)
its
View.AccessibilityDelegate.onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo)
is responsible for handling this call.
onInitializeAccessibilityNodeInfo
in class ListView
info
- The instance to initialize.