Class ExpandableListView
- All Implemented Interfaces:
Drawable.Callback
,ViewManager
,ViewParent
,Filter.FilterListener
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
invalid reference
SimpleCursorTreeAdapter
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
Modifier and TypeClassDescriptionstatic class
Extra menu information specific to anExpandableListView
provided to theView.OnCreateContextMenuListener.onCreateContextMenu(ContextMenu, View, ContextMenuInfo)
callback when a context menu is brought up for this AdapterView.static interface
Interface definition for a callback to be invoked when a child in this expandable list has been clicked.static interface
Interface definition for a callback to be invoked when a group in this expandable list has been clicked.static interface
Used for being notified when a group is collapsedstatic interface
Used for being notified when a group is expandedNested classes/interfaces inherited from class icyllis.modernui.widget.ListView
ListView.FixedViewInfo
Nested classes/interfaces inherited from class icyllis.modernui.widget.AbsListView
AbsListView.LayoutParams, AbsListView.MultiChoiceModeListener, AbsListView.OnScrollListener, AbsListView.RecyclerListener, AbsListView.SelectionBoundsAdjuster
Nested classes/interfaces inherited from class icyllis.modernui.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
Nested classes/interfaces inherited from class icyllis.modernui.view.ViewGroup
ViewGroup.MarginLayoutParams
Nested classes/interfaces inherited from class icyllis.modernui.view.View
View.DragShadow, View.Focusable, View.FocusableMode, View.FocusDirection, View.FocusRealDirection, View.LayoutDir, View.NestedScrollType, View.OnAttachStateChangeListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnTouchListener, View.ResolvedLayoutDir, View.ScrollAxis, View.ScrollBarStyle, View.ScrollIndicators, View.TextAlignment, View.Visibility
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Denotes when a child indicator should inherit this bound from the generic indicator boundsstatic final int
The packed position represents a child.static final int
The packed position represents a group.static final int
The packed position represents a neither/null/no preference.static final long
The value for a packed position that represents neither/null/no preference.Fields inherited from class icyllis.modernui.widget.AbsListView
CHOICE_MODE_MULTIPLE, CHOICE_MODE_MULTIPLE_MODAL, CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
Fields inherited from class icyllis.modernui.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
Fields inherited from class icyllis.modernui.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_DISALLOW_INTERCEPT, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS
Fields inherited from class icyllis.modernui.view.View
ALPHA, BOTTOM, EMPTY_STATE_SET, 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, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, 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, INVISIBLE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_UNDEFINED, LEFT, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mScrollX, mScrollY, NO_ID, NOT_FOCUSABLE, 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, RIGHT, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLL_X, SCROLL_Y, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, 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_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TOP, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, TYPE_NON_TOUCH, TYPE_TOUCH, VIEW_MARKER, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
collapseGroup
(int groupPos) Collapse a group in the grouped list viewprotected void
dispatchDraw
(Canvas canvas) Draw the child views.boolean
expandGroup
(int groupPos) Expand a group in the grouped list viewboolean
expandGroup
(int groupPos, boolean animate) Expand a group in the grouped list viewThis method should not be used, usegetExpandableListAdapter()
.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 ofPACKED_POSITION_TYPE_CHILD
type (usegetPackedPositionType(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
Gets the ID of the currently selected group or child.long
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
onRtlPropertiesChanged
(int layoutDirection) Called when any RTL property (layout direction or text direction or text alignment) has been changed.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 usesetAdapter(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
setChildIndicatorBoundsRelative
(int start, int end) Sets the relative 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
setIndicatorBoundsRelative
(int start, int end) Sets the relative 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
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 icyllis.modernui.widget.ListView
addFooterView, addFooterView, addHeaderView, addHeaderView, areFooterDividersEnabled, areHeaderDividersEnabled, dispatchDataSetObserverOnChangedInternal, dispatchKeyEvent, findViewByPredicateTraversal, findViewTraversal, getDivider, getDividerHeight, getFooterViewsCount, getHeaderViewsCount, getItemsCanFocus, getMaxScrollAmount, getOverscrollFooter, getOverscrollHeader, layoutChildren, onDetachedFromWindow, onFocusChanged, onKeyDown, onKeyUp, onMeasure, onSizeChanged, recycleOnMeasure, removeFooterView, removeHeaderView, requestChildRectangleOnScreen, setDivider, setDividerHeight, setFooterDividersEnabled, setHeaderDividersEnabled, setItemsCanFocus, setOverscrollFooter, setOverscrollHeader, setSelection, setSelectionAfterHeaderView, smoothScrollByOffset, smoothScrollToPosition, wrapHeaderListAdapterInternal, wrapHeaderListAdapterInternal
Methods inherited from class icyllis.modernui.widget.AbsListView
addTouchables, canScrollList, checkLayoutParams, clearChoices, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, dispatchDrawableHotspotChanged, dispatchSetPressed, drawableStateChanged, fling, generateDefaultLayoutParams, generateLayoutParams, getBottomEdgeEffectColor, getCheckedItemCount, getCheckedItemIds, getCheckedItemPosition, getCheckedItemPositions, getChoiceMode, getContextMenuInfo, getFocusedRect, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getSelectedView, getSelector, getTopEdgeEffectColor, getTranscriptMode, handleDataChanged, internalSetPadding, invalidateViews, isDrawSelectorOnTop, isItemChecked, isSmoothScrollbarEnabled, isStackFromBottom, onAttachedToWindow, onCancelPendingInputEvents, onDrawForeground, onFilterComplete, onGenericMotionEvent, onInterceptTouchEvent, onLayout, onNestedFling, onNestedScroll, onNestedScrollAccepted, onOverScrolled, onStartNestedScroll, onTouchEvent, onTouchModeChanged, onWindowFocusChanged, pointToPosition, pointToRowId, reclaimViews, requestDisallowInterceptTouchEvent, requestLayout, scrollListBy, setBottomEdgeEffectColor, setChoiceMode, setDrawSelectorOnTop, setEdgeEffectColor, setFriction, setItemChecked, setMultiChoiceModeListener, setOnScrollListener, setRecyclerListener, setScrollIndicators, setSelectionFromTop, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTopEdgeEffectColor, setTranscriptMode, setVelocityScale, shouldDrawSelector, showContextMenu, showContextMenuForChild, smoothScrollBy, smoothScrollToPosition, smoothScrollToPositionFromTop, smoothScrollToPositionFromTop, verifyDrawable
Methods inherited from class icyllis.modernui.widget.AdapterView
addView, addView, addView, addView, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemLongClickListener, setOnItemSelectedListener
Methods inherited from class icyllis.modernui.view.ViewGroup
addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTransientView, addView, addViewInLayout, addViewInLayout, attachViewToParent, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFinishTemporaryDetach, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchTouchEvent, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, focusableViewAvailable, focusSearch, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildMeasureSpec, getChildVisibleRect, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutTransition, getNestedScrollAxes, getTouchscreenBlocksFocus, getTransientView, getTransientViewCount, getTransientViewIndex, hasBooleanFlag, hasFocus, hasTransientState, indexOfChild, isChildrenDrawingOrderEnabled, isLayoutSuppressed, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onChildVisibilityChanged, onCreateDrawableState, onInterceptHoverEvent, onNestedPreFling, onNestedPreScroll, onRequestFocusInDescendants, onResolvePointerIcon, onSetLayoutParams, onStopNestedScroll, onViewAdded, onViewRemoved, removeAllViewsInLayout, removeDetachedView, removeTransientView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestFocus, requestTransitionStart, resetResolvedDrawables, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, restoreDefaultFocus, setAddStatesFromChildren, setBooleanFlag, setChildrenDrawingOrderEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutTransition, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, startActionModeForChild, startViewTransition, suppressLayout, transformPointToViewLocal, updateViewLayout
Methods inherited from class icyllis.modernui.view.View
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, awakenScrollBars, awakenScrollBars, callOnClick, cancelLongPress, cancelPendingInputEvents, canReceivePointerEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerEvent, dp, draw, drawableHotspotChanged, findViewById, findViewByPredicate, findViewByPredicateInsideOut, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAlpha, getAnimationMatrix, getBackground, getBaseline, getBottom, getBoundsOnScreen, getBoundsOnScreen, getContext, getDefaultSize, getDrawableState, getDrawingRect, getElevation, getFadingEdge, getFadingEdgeLength, getFocusable, getFocusables, getForeground, getForegroundGravity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getInverseMatrix, getKeyDispatcherState, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOnLongClickListener, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getRevealOnFocusHint, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTextAlignment, getTextDirection, getTooltipText, getTooltipView, getTop, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewRoot, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowVisibility, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasIdentityMatrix, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasTranslationTransientState, hasWindowFocus, invalidate, invalidateDrawable, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForegroundInsidePadding, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInLayout, isInScrollingContainer, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionInherited, isLayoutDirectionResolved, isLayoutRequested, isLayoutRtl, isLongClickable, isNestedScrollingEnabled, isPaddingRelative, isPivotSet, isPressed, isRootNamespace, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentInherited, isTextAlignmentResolved, isTextDirectionInherited, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVerticalScrollBarHidden, keyboardNavigationClusterSearch, mapRectFromViewToScreenCoords, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCreateContextMenu, onDragEvent, onDraw, onDrawScrollBars, onFinishTemporaryDetach, onHoverChanged, onHoverEvent, onKeyShortcut, onResolveDrawables, onScrollChanged, onStartTemporaryDetach, onVisibilityAggregated, onVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performButtonActionOnTouchDown, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, pointInView, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFocus, requestFocus, requestRectangleOnScreen, requestRectangleOnScreen, requireViewById, resetPivot, resolveSize, resolveSizeAndState, scheduleDrawable, scrollBy, scrollTo, setActivated, setAlpha, setAnimationMatrix, setBackground, setBottom, setClickable, setContextClickable, setDuplicateParentStateEnabled, setElevation, setEnabled, setFocusable, setFocusedByDefault, setFocusedInCluster, setForeground, setForegroundGravity, setFrame, setHapticFeedbackEnabled, setHasTransientState, setHasTranslationTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setIsRootNamespace, setKeyboardNavigationCluster, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setVisibility, setWillNotDraw, setX, setY, setZ, showContextMenu, sp, startActionMode, startActionMode, startDragAndDrop, startNestedScroll, stopNestedScroll, toGlobalMotionEvent, toLocalMotionEvent, toString, transformFromViewToWindowSpace, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, willNotDraw
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface icyllis.modernui.view.ViewParent
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch
-
Field Details
-
PACKED_POSITION_TYPE_GROUP
public static final int PACKED_POSITION_TYPE_GROUPThe packed position represents a group.- See Also:
-
PACKED_POSITION_TYPE_CHILD
public static final int PACKED_POSITION_TYPE_CHILDThe packed position represents a child.- See Also:
-
PACKED_POSITION_TYPE_NULL
public static final int PACKED_POSITION_TYPE_NULLThe packed position represents a neither/null/no preference.- See Also:
-
PACKED_POSITION_VALUE_NULL
public static final long PACKED_POSITION_VALUE_NULLThe 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:
-
CHILD_INDICATOR_INHERIT
public static final int CHILD_INDICATOR_INHERITDenotes when a child indicator should inherit this bound from the generic indicator bounds- See Also:
-
-
Constructor Details
-
ExpandableListView
-
-
Method Details
-
onRtlPropertiesChanged
public void onRtlPropertiesChanged(int layoutDirection) Description copied from class:View
Called when any RTL property (layout direction or text direction or text alignment) has been changed.Subclasses need to override this method to take care of cached information that depends on the resolved layout direction, or to inform child views that inherit their layout direction.
The default implementation does nothing.
- Overrides:
onRtlPropertiesChanged
in classView
- Parameters:
layoutDirection
- the direction of the layout- See Also:
-
dispatchDraw
Description copied from class:View
Draw the child views.- Overrides:
dispatchDraw
in classListView
- Parameters:
canvas
- the canvas to draw content
-
setChildDivider
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 byListView.setDividerHeight(int)
.- Parameters:
childDivider
- The drawable to use.
-
setAdapter
This overloaded method should not be used, instead usesetAdapter(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 classListView
- 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:
-
getAdapter
This method should not be used, usegetExpandableListAdapter()
.- Overrides:
getAdapter
in classListView
- Returns:
- The adapter currently used to display data in this ListView.
- See Also:
-
setOnItemClickListener
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 usesetOnGroupClickListener(icyllis.modernui.widget.ExpandableListView.OnGroupClickListener)
and/orsetOnChildClickListener(icyllis.modernui.widget.ExpandableListView.OnChildClickListener)
. Register a callback to be invoked when an item in this AdapterView has been clicked.- Overrides:
setOnItemClickListener
in classAdapterView<ListAdapter>
- Parameters:
l
- The callback that will be invoked.
-
setAdapter
Sets the adapter that provides data to this view.- Parameters:
adapter
- The adapter that provides data to this view.
-
getExpandableListAdapter
Gets the adapter that provides data to this view.- Returns:
- The adapter that provides data to this view.
-
performItemClick
Description copied from class:AdapterView
Call the OnItemClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.- Overrides:
performItemClick
in classAbsListView
- 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.
-
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)
-
expandGroup
public boolean expandGroup(int groupPos, boolean animate) Expand a group in the grouped list view- Parameters:
groupPos
- the group to be expandedanimate
- true if the expanding group should be animated in- 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
-
setOnChildClickListener
-
getExpandableListPosition
public 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). This is useful in situations where the caller needs to use the underlyingListView
's methods. UsegetPackedPositionType(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. #PACKED_POSITION_VALUE_NULL if the position corresponds to a header or a footer item.
-
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 underlyingListView
's methods.- Parameters:
packedPosition
- The group and/or child positions to be converted in packed position representation. UsegetPackedPositionForChild(int, int)
orgetPackedPositionForGroup(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 returnPACKED_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 or if selection is on a header or a footer item.
-
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. SeegetPackedPositionForChild(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
, orPACKED_POSITION_TYPE_NULL
.
-
getPackedPositionGroup
public static int getPackedPositionGroup(long packedPosition) Gets the group position from a packed position. SeegetPackedPositionForChild(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 ofPACKED_POSITION_TYPE_CHILD
type (usegetPackedPositionType(long)
). To get the group that this child belongs to, usegetPackedPositionGroup(long)
. SeegetPackedPositionForChild(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
orExpandableListView
method can either be a child or group. The two positions are packed into a single long which can be unpacked usinggetPackedPositionChild(long)
,getPackedPositionGroup(long)
, andgetPackedPositionType(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. SeegetPackedPositionForChild(int, int)
.- Parameters:
groupPosition
- The child's parent group's position.- Returns:
- The packed position representation of the group.
-
setChildIndicator
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 stateR.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 specifyCHILD_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:
-
setChildIndicatorBoundsRelative
public void setChildIndicatorBoundsRelative(int start, int end) Sets the relative drawing bounds for the child indicator. For either, you can specifyCHILD_INDICATOR_INHERIT
to use inherit from the general indicator's bounds.- Parameters:
start
- The start position (relative to the start bounds of this View) to start drawing the indicator.end
- The end position (relative to the end bounds of this View) to end the drawing of the indicator.- See Also:
-
setGroupIndicator
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 stateR.attr.state_empty
will be set. If the group is expanded, the stateR.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:
-
setIndicatorBoundsRelative
public void setIndicatorBoundsRelative(int start, int end) Sets the relative 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:
start
- The start position (relative to the start bounds of this View) to start drawing the indicator.end
- The end position (relative to the end bounds of this View) to end the drawing of the indicator.- See Also:
-