当前位置: 首页>>代码示例>>Java>>正文


Java ExpandableListAdapter类代码示例

本文整理汇总了Java中android.widget.ExpandableListAdapter的典型用法代码示例。如果您正苦于以下问题:Java ExpandableListAdapter类的具体用法?Java ExpandableListAdapter怎么用?Java ExpandableListAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExpandableListAdapter类属于android.widget包,在下文中一共展示了ExpandableListAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setExpandedListViewHeightBasedOnChildren

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
public static void setExpandedListViewHeightBasedOnChildren(ExpandableListView listView, int groupPosition) {
    ExpandableListAdapter listAdapter = listView.getExpandableListAdapter();
    if (listAdapter == null) {
        return;
    }
    View listItem = listAdapter.getChildView(groupPosition, 0, true, null,
            listView);
    listItem.measure(0, 0);
    int appendHeight = 0;
    for (int i = 0; i < listAdapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height += appendHeight;
    listView.setLayoutParams(params);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:17,代码来源:ExpandedListUtils.java

示例2: setCollapseListViewHeightBasedOnChildren

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
public static void setCollapseListViewHeightBasedOnChildren(ExpandableListView listView, int groupPosition) {
    ExpandableListAdapter listAdapter = listView.getExpandableListAdapter();
    if (listAdapter == null) {
        return;
    }
    View listItem = listAdapter.getChildView(groupPosition, 0, true, null,
            listView);
    listItem.measure(0, 0);
    int appendHeight = 0;
    for (int i = 0; i < listAdapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height -= appendHeight;
    listView.setLayoutParams(params);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:17,代码来源:ExpandedListUtils.java

示例3: getExpandedIds

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:17,代码来源:RootsFragment.java

示例4: setAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
/**
 * Sets the adapter that provides data to this view.
 *
 * @param adapter The adapter that provides data to this view.
 */
public void setAdapter( ExpandableListAdapter adapter ) {
	// Set member variable
	mAdapter = adapter;

	if( adapter != null ) {
		// Create the connector
		mConnector = new ExpandableHListConnector( adapter );
	}
	else {
		mConnector = null;
	}

	// Link the ListView (superclass) to the expandable list data through the connector
	super.setAdapter( mConnector );
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:21,代码来源:ExpandableHListView.java

示例5: setAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
@Override
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);
    mAdapter = adapter;
    mHeaderView = adapter.getGroupView(0, false, null, this);
    boolean isBaseAdapter = adapter instanceof BaseExpandableListAdapter;
    if (cacheHeaderViews == null) {
        if (isBaseAdapter) {
            int typeCount = ((BaseExpandableListAdapter) adapter).getGroupTypeCount();
            cacheHeaderViews = new SparseArray<>(typeCount);
        }
        cacheHeaderViews = new SparseArray<>(1);
    }
    if (mHeaderView != null) {
        int groupType = 0;
        if (isBaseAdapter) {
            groupType = ((BaseExpandableListAdapter) adapter).getGroupType(0);
            cacheHeaderViews.put(groupType, mHeaderView);
        }
        cacheHeaderViews.put(groupType, mHeaderView);
    }
}
 
开发者ID:KobeGong,项目名称:StickyAnimatedExpandableGridView,代码行数:23,代码来源:StickyHeaderExpandableGridView.java

示例6: setExpandableListAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
public void setExpandableListAdapter(ExpandableListAdapter adapter){
	mAdapter=null;
	boolean hadAdapter = mExpandableListAdapter != null;
	mExpandableListAdapter = adapter;
	if (mList!=null && !(mList instanceof ExpandableListView)){
		changeListView(true);
		
	}
	if (mList instanceof ExpandableListView) {
        ((ExpandableListView)mList).setAdapter(adapter);
        if (!mListShown && !hadAdapter) {
            // The list was hidden, and previously didn't have an
            // adapter.  It is now time to show it.
            setListShown(true, getView().getWindowToken() != null);
        }
    }
   
}
 
开发者ID:rockgecko-development,项目名称:connectedteam-android,代码行数:19,代码来源:ListOrExpandableListFragment.java

示例7: onCreateView

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.frament_all_list, null);
	
	this.list = (ExpandableListView) view.findViewById(R.id.expandableListView1);
	
	this.list.setOnChildClickListener(new OnChildClickListener() {
		@Override
		public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
			ExpandableListAdapter adapter = parent.getExpandableListAdapter();
			MyActivityInfo info = (MyActivityInfo)adapter.getChild(groupPosition, childPosition);
			LauncherIconCreator.launchActivity(getActivity(), info.component_name);
			return false;
		}
	});
	
	AllTasksListAsyncProvider provider = new AllTasksListAsyncProvider(this.getActivity(), this);
	provider.execute();
	
	return view;
}
 
开发者ID:butzist,项目名称:ActivityLauncher,代码行数:23,代码来源:AllTasksListFragment.java

示例8: clearDataAndShowLoadingIndicator

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
private void clearDataAndShowLoadingIndicator() {
    if (mProgressIndicator != null) {
        mNonExpandableListView.setEmptyView(null);
        mNonExpandableListView.setVisibility(View.GONE);
        mNonExpandableListView.setOnItemClickListener(null);
        mNonExpandableListView.setAdapter(null);

        mExpandableListView.setEmptyView(null);
        mExpandableListView.setVisibility(View.GONE);
        mExpandableListView.setOnChildClickListener(null);
        mExpandableListView.setAdapter((ExpandableListAdapter) null);

        mEmptyMessage.setVisibility(View.GONE);
        mCustomErrorText.setVisibility(View.GONE);
        mProgressIndicator.setVisibility(View.VISIBLE);
    }

    mLoadedData = null;
}
 
开发者ID:michalbednarski,项目名称:IntentsLab,代码行数:20,代码来源:BrowseComponentsFragment.java

示例9: setAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
@Override
public void setAdapter(final ExpandableListAdapter adapter){

	if (adapter == null)
		throw new NullPointerException("The adapter you passed was null");


	if (adapter instanceof MultiChoiceExpandableAdapter)
		this.mAdapterWrapper = (MultiChoiceExpandableAdapter) adapter;

	else if (mAdapterWrapper == null)
		mAdapterWrapper = new MultiChoiceExpandableAdapter(	adapter,
															this);
	else
		mAdapterWrapper.setWrappedAdapter(adapter);

	super.setAdapter(mAdapterWrapper);

	mCheckStore = new CheckStateStore(this); // Must do this to ensure
												// hasStableIds stays
												// current
}
 
开发者ID:kemallette,项目名称:MultiChoiceExpandableList,代码行数:23,代码来源:MultiChoiceExpandableListView.java

示例10: 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

示例11: selectChildView

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
private void selectChildView(ExpandableListView expandLV, int groupPosition, int childPosition, boolean force)
{
    if (groupPosition < mAdapter.getGroupCount() && childPosition < mAdapter.getChildrenCount(groupPosition))
    {
        // a task instance element has been clicked, get it's instance id and notify the activity
        ExpandableListAdapter listAdapter = expandLV.getExpandableListAdapter();
        Cursor cursor = (Cursor) listAdapter.getChild(groupPosition, childPosition);

        if (cursor == null)
        {
            return;
        }
        // TODO: for now we get the id of the task, not the instance, once we support recurrence we'll have to change that
        Long selectTaskId = cursor.getLong(cursor.getColumnIndex(Instances.TASK_ID));

        if (selectTaskId != null)
        {
            // Notify the active callbacks interface (the activity, if the fragment is attached to one) that an item has been selected.

            // TODO: use the instance URI one we support recurrence
            Uri taskUri = ContentUris.withAppendedId(Tasks.getContentUri(mAuthority), selectTaskId);

            mCallbacks.onItemSelected(taskUri, force, mInstancePosition);
        }
    }
}
 
开发者ID:dmfs,项目名称:opentasks,代码行数:27,代码来源:TaskListFragment.java

示例12: 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

示例13: KeyValueView

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
public KeyValueView(Context context, KVSaver kvSaver) {
    super(context);
    this.kvSaver = kvSaver;

    inflate(context, R.layout.view_keyvalue, this);
    listView = findViewById(R.id.list_keyvalue);
    adapter = new KeyValueAdapter(LayoutInflater.from(context));
    listView.setAdapter((ExpandableListAdapter) adapter);

    updateData();
    kvSaver.addObserver(this);
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:13,代码来源:KeyValueView.java

示例14: setListAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(ExpandableListAdapter adapter) {
	synchronized (this) {
		ensureList();
		mAdapter = adapter;
		mList.setAdapter(adapter);
	}
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:11,代码来源:ExpandableListActivity.java

示例15: setListAdapter

import android.widget.ExpandableListAdapter; //导入依赖的package包/类
/**
 * Provide the adapter for the expandable list.
 */
void setListAdapter(ExpandableListAdapter adapter) {
    synchronized (this) {
        ensureList();
        mAdapter = adapter;
        mList.setAdapter(adapter);
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:11,代码来源:FixedExpandableListActivity.java


注:本文中的android.widget.ExpandableListAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。