當前位置: 首頁>>代碼示例>>Java>>正文


Java ExpandableListAdapter.getGroupId方法代碼示例

本文整理匯總了Java中android.widget.ExpandableListAdapter.getGroupId方法的典型用法代碼示例。如果您正苦於以下問題:Java ExpandableListAdapter.getGroupId方法的具體用法?Java ExpandableListAdapter.getGroupId怎麽用?Java ExpandableListAdapter.getGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ExpandableListAdapter的用法示例。


在下文中一共展示了ExpandableListAdapter.getGroupId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: expandGroups

import android.widget.ExpandableListAdapter; //導入方法依賴的package包/類
public void expandGroups(long[] groupsToExpand)
{
    // this.expandedIds = expandedIds;
    if (groupsToExpand != null && groupsToExpand.length > 0)
    {
        ExpandableListAdapter adapter = getExpandableListAdapter();
        if (adapter != null)
        {
            for (int i = 0; i < adapter.getGroupCount(); i++)
            {
                long id = adapter.getGroupId(i);
                if (inArray(groupsToExpand, id))
                {
                    expandGroup(i);
                }
            }
        }
    }
}
 
開發者ID:dmfs,項目名稱:opentasks,代碼行數:20,代碼來源:RetainExpandableListView.java

示例2: restoreExpandedState

import android.widget.ExpandableListAdapter; //導入方法依賴的package包/類
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:14,代碼來源:RootsFragment.java

示例3: findGroupPosition

import android.widget.ExpandableListAdapter; //導入方法依賴的package包/類
int findGroupPosition(long groupIdToMatch, int seedGroupPosition) {
    int count = mExpandableListAdapter.getGroupCount();
    if (count == 0) {
        return AdapterView.INVALID_POSITION;
    }
    if (groupIdToMatch == AdapterView.INVALID_ROW_ID) {
        return AdapterView.INVALID_POSITION;
    }
    seedGroupPosition = Math.max(0, seedGroupPosition);
    seedGroupPosition = Math.min(count - 1, seedGroupPosition);
    long endTime = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;
    long rowId;
    int first = seedGroupPosition;
    int last = seedGroupPosition;
    boolean next = false;
    boolean hitFirst;
    boolean hitLast;
    ExpandableListAdapter adapter = getAdapter();
    if (adapter == null) {
        return AdapterView.INVALID_POSITION;
    }
    while (SystemClock.uptimeMillis() <= endTime) {
        rowId = adapter.getGroupId(seedGroupPosition);
        if (rowId == groupIdToMatch) {
            return seedGroupPosition;
        }
        hitLast = last == count - 1;
        hitFirst = first == 0;
        if (hitLast && hitFirst) {
            break;
        }
        if (hitFirst || next && !hitLast) {
            last++;
            seedGroupPosition = last;
            next = false;
        } else if (hitLast || !next && !hitFirst) {
            first--;
            seedGroupPosition = first;
            next = true;
        }
    }
    return AdapterView.INVALID_POSITION;
}
 
開發者ID:restorer,項目名稱:gloomy-dungeons-2,代碼行數:44,代碼來源:ExpandableListConnector.java


注:本文中的android.widget.ExpandableListAdapter.getGroupId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。