本文整理匯總了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);
}
}