ExpandableListView

public class ExpandableListView
extends ListView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.AdapterView<android.widget.ListAdapter>
         ↳ android.widget.AbsListView
           ↳ android.widget.ListView
             ↳ android.widget.ExpandableListView


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(android.graphics.drawable.Drawable) or setGroupIndicator(android.graphics.drawable.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 ExpandableListContextMenuInfo object with 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.

Summary

Nested classes

class ExpandableListView.ExpandableListContextMenuInfo

Extra menu information specific to an ExpandableListView provided to the View.OnCreateContextMenuListener.onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when a context menu is brought up for this AdapterView. 

interface ExpandableListView.OnChildClickListener

Interface definition for a callback to be invoked when a child in this expandable list has been clicked. 

interface ExpandableListView.OnGroupClickListener

Interface definition for a callback to be invoked when a group in this expandable list has been clicked. 

interface ExpandableListView.OnGroupCollapseListener

Used for being notified when a group is collapsed 

interface ExpandableListView.OnGroupExpandListener

Used for being notified when a group is expanded 

XML attributes

android:childDivider Drawable or color that is used as a divider for children. 
android:childIndicator Indicator shown beside the child View. 
android:childIndicatorEnd The end bound for a child's indicator. 
android:childIndicatorLeft The left bound for a child's indicator. 
android:childIndicatorRight The right bound for a child's indicator. 
android:childIndicatorStart The start bound for a child's indicator. 
android:groupIndicator Indicator shown beside the group View. 
android:indicatorEnd The end bound for an item's indicator. 
android:indicatorLeft The left bound for an item's indicator. 
android:indicatorRight The right bound for an item's indicator. 
android:indicatorStart The start bound for an item's indicator. 

Inherited XML attributes

Constants

int CHILD_INDICATOR_INHERIT

Denotes when a child indicator should inherit this bound from the generic indicator bounds

int PACKED_POSITION_TYPE_CHILD

The packed position represents a child.

int PACKED_POSITION_TYPE_GROUP

The packed position represents a group.

int PACKED_POSITION_TYPE_NULL

The packed position represents a neither/null/no preference.

long PACKED_POSITION_VALUE_NULL

The value for a packed position that represents neither/null/no preference.

Inherited constants

Inherited fields

Public constructors

ExpandableListView(Context context)
ExpandableListView(Context context, AttributeSet attrs)
ExpandableListView(Context context, AttributeSet attrs, int defStyleAttr)
ExpandableListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

boolean collapseGroup(int groupPos)

Collapse a group in the grouped list view

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

CharSequence getAccessibilityClassName()

A TYPE_VIEW_SCROLLED event should be sent whenever a scroll happens, even if the mFirstPosition and the child count have not changed.

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 onRestoreInstanceState(Parcelable state)

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().

void onRtlPropertiesChanged(int layoutDirection)

Called when any RTL property (layout direction or text direction or text alignment) has been changed.

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(ListAdapter adapter)

This overloaded method should not be used, instead use setAdapter(android.widget.ExpandableListAdapter).

void setAdapter(ExpandableListAdapter adapter)

Sets the adapter that provides data to this view.

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 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.

Protected methods

void dispatchDraw(Canvas canvas)

Called by draw to draw the child views.

Inherited methods

XML attributes

android:childDivider

Drawable or color that is used as a divider for children. (It will drawn below and above child items.) The height of this will be the same as the height of the normal list item divider.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

android:childIndicator

Indicator shown beside the child View. This can be a stateful Drawable.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:childIndicatorEnd

The end bound for a child's indicator.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:childIndicatorLeft

The left bound for a child's indicator.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:childIndicatorRight

The right bound for a child's indicator.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:childIndicatorStart

The start bound for a child's indicator.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:groupIndicator

Indicator shown beside the group View. This can be a stateful Drawable.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:indicatorEnd

The end bound for an item's indicator. To specify a right bound specific to children, use childIndicatorEnd.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:indicatorLeft

The left bound for an item's indicator. To specify a left bound specific to children, use childIndicatorLeft.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:indicatorRight

The right bound for an item's indicator. To specify a right bound specific to children, use childIndicatorRight.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

android:indicatorStart

The start bound for an item's indicator. To specify a start bound specific to children, use childIndicatorStart.

May be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

Constants

CHILD_INDICATOR_INHERIT

Added in API level 1
public static final int CHILD_INDICATOR_INHERIT

Denotes when a child indicator should inherit this bound from the generic indicator bounds

Constant Value: -1 (0xffffffff)

PACKED_POSITION_TYPE_CHILD

Added in API level 1
public static final int PACKED_POSITION_TYPE_CHILD

The packed position represents a child.

Constant Value: 1 (0x00000001)

PACKED_POSITION_TYPE_GROUP

Added in API level 1
public static final int PACKED_POSITION_TYPE_GROUP

The packed position represents a group.

Constant Value: 0 (0x00000000)

PACKED_POSITION_TYPE_NULL

Added in API level 1
public static final int PACKED_POSITION_TYPE_NULL

The packed position represents a neither/null/no preference.

Constant Value: 2 (0x00000002)

PACKED_POSITION_VALUE_NULL

Added in API level 1
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.

Constant Value: 4294967295 (0x00000000ffffffff)

Public constructors

ExpandableListView

Added in API level 1
public ExpandableListView (Context context)

Parameters
context Context

ExpandableListView

Added in API level 1
public ExpandableListView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

ExpandableListView

Added in API level 1
public ExpandableListView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

ExpandableListView

Added in API level 1
public ExpandableListView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

collapseGroup

Added in API level 1
public boolean collapseGroup (int groupPos)

Collapse a group in the grouped list view

Parameters
groupPos int: position of the group to collapse

Returns
boolean True if the group was collapsed, false otherwise (if the group was already collapsed, this will return false)

expandGroup

Added in API level 1
public boolean expandGroup (int groupPos)

Expand a group in the grouped list view

Parameters
groupPos int: the group to be expanded

Returns
boolean True if the group was expanded, false otherwise (if the group was already expanded, this will return false)

expandGroup

Added in API level 14
public boolean expandGroup (int groupPos, 
                boolean animate)

Expand a group in the grouped list view

Parameters
groupPos int: the group to be expanded

animate boolean: true if the expanding group should be animated in

Returns
boolean True if the group was expanded, false otherwise (if the group was already expanded, this will return false)

getAccessibilityClassName

Added in API level 23
public CharSequence getAccessibilityClassName ()

A TYPE_VIEW_SCROLLED event should be sent whenever a scroll happens, even if the mFirstPosition and the child count have not changed.

Returns
CharSequence

getAdapter

Added in API level 1
public ListAdapter getAdapter ()

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

Returns
ListAdapter The adapter currently used to display data in this ListView.

getExpandableListAdapter

Added in API level 1
public ExpandableListAdapter getExpandableListAdapter ()

Gets the adapter that provides data to this view.

Returns
ExpandableListAdapter The adapter that provides data to this view.

getExpandableListPosition

Added in API level 1
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 underlying ListView's methods. Use ExpandableListView#getPackedPositionType , ExpandableListView#getPackedPositionChild, ExpandableListView#getPackedPositionGroup to unpack.

Parameters
flatListPosition int: The flat list position to be converted.

Returns
long 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

Added in API level 1
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 long: The group and/or child positions to be converted in packed position representation. Use getPackedPositionForChild(int, int) or getPackedPositionForGroup(int).

Returns
int The flat list position for the given child or group.

getPackedPositionChild

Added in API level 1
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 long: The packed position from which the child position will be returned.

Returns
int The child position portion of the packed position. If this does not contain a child, returns -1.

getPackedPositionForChild

Added in API level 1
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 int: The child's parent group's position.

childPosition int: The child position within the group.

Returns
long The packed position representation of the child (and parent group).

getPackedPositionForGroup

Added in API level 1
public static long getPackedPositionForGroup (int groupPosition)

Returns the packed position representation of a group's position. See getPackedPositionForChild(int, int).

Parameters
groupPosition int: The child's parent group's position.

Returns
long The packed position representation of the group.

getPackedPositionGroup

Added in API level 1
public static int getPackedPositionGroup (long packedPosition)

Gets the group position from a packed position. See getPackedPositionForChild(int, int).

Parameters
packedPosition long: The packed position from which the group position will be returned.

Returns
int The group position portion of the packed position. If this does not contain a group, returns -1.

getPackedPositionType

Added in API level 1
public static int getPackedPositionType (long packedPosition)

Gets the type of a packed position. See getPackedPositionForChild(int, int).

Parameters
packedPosition long: The packed position for which to return the type.

Returns
int The type of the position contained within the packed position, either PACKED_POSITION_TYPE_CHILD, PACKED_POSITION_TYPE_GROUP, or PACKED_POSITION_TYPE_NULL.

getSelectedId

Added in API level 1
public long getSelectedId ()

Gets the ID of the currently selected group or child. Can return -1 if no selection.

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

getSelectedPosition

Added in API level 1
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
long 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.

isGroupExpanded

Added in API level 1
public boolean isGroupExpanded (int groupPosition)

Whether the given group is currently expanded.

Parameters
groupPosition int: The group to check.

Returns
boolean Whether the group is currently expanded.

onRestoreInstanceState

Added in API level 1
public void onRestoreInstanceState (Parcelable state)

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState(). This function will never be called with a null state.
If you override this method you must call through to the superclass implementation.

Parameters
state Parcelable: The frozen state that had previously been returned by onSaveInstanceState().

onRtlPropertiesChanged

Added in API level 17
public void onRtlPropertiesChanged (int layoutDirection)

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.

Parameters
layoutDirection int: the direction of the layout Value is View.LAYOUT_DIRECTION_LTR, or View.LAYOUT_DIRECTION_RTL

onSaveInstanceState

Added in API level 1
public 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. 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.
If you override this method you must call through to the superclass implementation.

Returns
Parcelable Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save.

performItemClick

Added in API level 1
public boolean performItemClick (View v, 
                int position, 
                long id)

Call the OnItemClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.

Parameters
v View: The view within the AdapterView that was clicked.

position int: The position of the view in the adapter.

id long: The row id of the item that was clicked.

Returns
boolean True if there was an assigned OnItemClickListener that was called, false otherwise is returned.

setAdapter

Added in API level 1
public void setAdapter (ListAdapter adapter)

This overloaded method should not be used, instead use setAdapter(android.widget.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.

Parameters
adapter ListAdapter: 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.

setAdapter

Added in API level 1
public void setAdapter (ExpandableListAdapter adapter)

Sets the adapter that provides data to this view.

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

setChildDivider

Added in API level 1
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(android.graphics.drawable.Drawable)) or if it does not have an intrinsic height, the height set by ListView.setDividerHeight(int).

Parameters
childDivider Drawable: The drawable to use.

setChildIndicator

Added in API level 1
public void setChildIndicator (Drawable childIndicator)

Sets the indicator to be drawn next to a child.

Parameters
childIndicator Drawable: 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

Added in API level 1
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 int: The left position (relative to the left bounds of this View) to start drawing the indicator.

right int: The right position (relative to the left bounds of this View) to end the drawing of the indicator.

setChildIndicatorBoundsRelative

Added in API level 18
public void setChildIndicatorBoundsRelative (int start, 
                int end)

Sets the relative drawing bounds for the child indicator. For either, you can specify CHILD_INDICATOR_INHERIT to use inherit from the general indicator's bounds.

Parameters
start int: The start position (relative to the start bounds of this View) to start drawing the indicator.

end int: The end position (relative to the end bounds of this View) to end the drawing of the indicator.

setGroupIndicator

Added in API level 1
public void setGroupIndicator (Drawable groupIndicator)

Sets the indicator to be drawn next to a group.

Parameters
groupIndicator Drawable: 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

Added in API level 1
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 int: The left position (relative to the left bounds of this View) to start drawing the indicator.

right int: The right position (relative to the left bounds of this View) to end the drawing of the indicator.

setIndicatorBoundsRelative

Added in API level 18
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 int: The start position (relative to the start bounds of this View) to start drawing the indicator.

end int: The end position (relative to the end bounds of this View) to end the drawing of the indicator.

setOnChildClickListener

Added in API level 1
public void setOnChildClickListener (ExpandableListView.OnChildClickListener onChildClickListener)

Parameters
onChildClickListener ExpandableListView.OnChildClickListener

setOnGroupClickListener

Added in API level 1
public void setOnGroupClickListener (ExpandableListView.OnGroupClickListener onGroupClickListener)

Parameters
onGroupClickListener ExpandableListView.OnGroupClickListener

setOnGroupCollapseListener

Added in API level 1
public void setOnGroupCollapseListener (ExpandableListView.OnGroupCollapseListener onGroupCollapseListener)

Parameters
onGroupCollapseListener ExpandableListView.OnGroupCollapseListener

setOnGroupExpandListener

Added in API level 1
public void setOnGroupExpandListener (ExpandableListView.OnGroupExpandListener onGroupExpandListener)

Parameters
onGroupExpandListener ExpandableListView.OnGroupExpandListener

setOnItemClickListener

Added in API level 1
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(OnGroupClickListener) and/or setOnChildClickListener(OnChildClickListener).

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

Parameters
l AdapterView.OnItemClickListener: The callback that will be invoked. This value may be null.

setSelectedChild

Added in API level 1
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 int: The position of the group that contains the child.

childPosition int: The position of the child within the group.

shouldExpandGroup boolean: Whether the child's group should be expanded if it is collapsed.

Returns
boolean Whether the selection was successfully set on the child.

setSelectedGroup

Added in API level 1
public void setSelectedGroup (int groupPosition)

Sets the selection to the specified group.

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

Protected methods

dispatchDraw

Added in API level 1
protected void dispatchDraw (Canvas canvas)

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).

Parameters
canvas Canvas: This value cannot be null.