Code example for ExpandableListView

Methods: getChildAtpointToPositiongetExpandableListPositionisGroupExpanded

0
        // The first visible flat item position 
        final int fvPos = view.getFirstVisiblePosition();
        final int fPos = view.pointToPosition(0, 0);
        if (fPos != AdapterView.INVALID_POSITION) {
            // To get the corresponds packed position. 
            final long pPos = mList.getExpandableListPosition(fPos);
            // To check whether the packed position is header or footer. 
            if (pPos != ExpandableListView.PACKED_POSITION_VALUE_NULL) {
                // Extract the group and child position. 
                final int groupPos = ExpandableListView.getPackedPositionGroup(pPos);
                final int childPos = ExpandableListView.getPackedPositionChild(pPos);
                if (childPos == AdapterView.INVALID_POSITION) {
                    // The flat position is a group item, no child item. 
                    // Then try to get the group item height. 
                    indicatorGroupHeight = mList.getChildAt(fPos - fvPos).getHeight();
                } 
                if (indicatorGroupHeight == 0) {
                    return; 
                } 
                // Set the flotView's visibility and data. 
                if (mList.isGroupExpanded(groupPos)) {
                    mFlotageView.setVisibility(View.VISIBLE);
                    onFlotageViewContentChanged(groupPos, childPos);
                    // Try to adjust the flotageView's place. 
                    final int nfPos = mList.pointToPosition(0, indicatorGroupHeight);
                    if (nfPos != AdapterView.INVALID_POSITION && fPos != nfPos) {
                        final long npPos = mList.getExpandableListPosition(nfPos);
                        final int ngroupPos = ExpandableListView.getPackedPositionGroup(npPos);
                        final int newIndicatorGroupHeight;
                        if (groupPos != ngroupPos) {
                            newIndicatorGroupHeight = mList.getChildAt(nfPos - fvPos).getTop();
                        } else { 
                            newIndicatorGroupHeight = indicatorGroupHeight;
                        } 
                        // Try to adjust the list. 
                        MarginLayoutParams params = (MarginLayoutParams) mFlotageView
Connect your IDE to all the code out there  Get Codota for Java