本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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 );
}
示例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;
}
示例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;
}
示例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
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
}