android.widget.ListAdapter.getViewTypeCount()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中android.widget.ListAdapter.getViewTypeCount()方法的一些代码示例,展示了ListAdapter.getViewTypeCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAdapter.getViewTypeCount()方法的具体详情如下:
包路径:android.widget.ListAdapter
类名称:ListAdapter
方法名:getViewTypeCount

ListAdapter.getViewTypeCount介绍

暂无

代码示例

代码示例来源:origin: rey5137/material

public int getViewTypeCount() {
  final ListAdapter adapter = mListAdapter;
  if (adapter != null)
    return adapter.getViewTypeCount();
  else
    return 1;
}

代码示例来源:origin: chentao0707/SimplifyReader

public int getViewTypeCount() {
  if (mAdapter != null) {
    return mAdapter.getViewTypeCount();
  }
  return 1;
}

代码示例来源:origin: chentao0707/SimplifyReader

@Override
public int getViewTypeCount() {
  if (mAdapter != null) {
    return mAdapter.getViewTypeCount();
  }
  return 1;
}

代码示例来源:origin: TonicArtos/StickyGridHeaders

@Override
public int getViewTypeCount() {
  return mDelegate.getViewTypeCount();
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

/**
 * Content view, content view holder, header[0], header and footer placeholder(s).
 */
@Override
public int getViewTypeCount() {
  int count = mAdapter == null ? 1 : mAdapter.getViewTypeCount();
  if (mCachePlaceHoldView) {
    int offset = mHeaderViewInfos.size() + 1 + mFooterViewInfos.size();
    if (mCacheFirstHeaderView) {
      offset += 1;
    }
    count += offset;
  }
  return count;
}

代码示例来源:origin: liaohuqiu/android-GridViewWithHeaderAndFooter

/**
 * content view, content view holder, header[0], header and footer placeholder(s)
 *
 * @return
 */
@Override
public int getViewTypeCount() {
  int count = mAdapter == null ? 1 : mAdapter.getViewTypeCount();
  if (mCachePlaceHoldView) {
    int offset = mHeaderViewInfos.size() + 1 + mFooterViewInfos.size();
    if (mCacheFirstHeaderView) {
      offset += 1;
    }
    count += offset;
  }
  if (DEBUG) {
    Log.d(LOG_TAG, String.format("getViewTypeCount: %s", count));
  }
  return count;
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

final int adapterViewTypeStart = mAdapter == null ? 0 : mAdapter.getViewTypeCount() - 1;
int type = AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
if (mCachePlaceHoldView) {

代码示例来源:origin: beworker/pinned-section-listview

@Override
public void setAdapter(ListAdapter adapter) {
  // assert adapter in debug mode
  if (adapter != null) {
    if (!(adapter instanceof PinnedSectionListAdapter))
      throw new IllegalArgumentException("Does your adapter implement PinnedSectionListAdapter?");
    if (adapter.getViewTypeCount() < 2)
      throw new IllegalArgumentException("Does your adapter handle at least two types" +
          " of views in getViewTypeCount() method: items and sections?");
  }
  // unregister observer at old adapter and register on new one
  ListAdapter oldAdapter = getAdapter();
  if (oldAdapter != null) oldAdapter.unregisterDataSetObserver(mDataSetObserver);
  if (adapter != null) adapter.registerDataSetObserver(mDataSetObserver);
  // destroy pinned shadow, if new adapter is not same as old one
  if (oldAdapter != adapter) destroyPinnedShadow();
  super.setAdapter(adapter);
}

代码示例来源:origin: liaohuqiu/android-GridViewWithHeaderAndFooter

final int adapterViewTypeStart = mAdapter == null ? 0 : mAdapter.getViewTypeCount() - 1;
int type = AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
if (mCachePlaceHoldView) {

代码示例来源:origin: chentao0707/SimplifyReader

mAdapter.registerDataSetObserver(mDataSetObserver);
mRecycler.setViewTypeCount(mAdapter.getViewTypeCount());

代码示例来源:origin: UweTrottmann/SeriesGuide

@Override
public int getViewTypeCount() {
  return mAdapter.getViewTypeCount();
}

代码示例来源:origin: stackoverflow.com

return originalAdapter.getViewTypeCount();

代码示例来源:origin: xiangzhihong/gpuImage

public int getViewTypeCount() {
  if (mAdapter != null) {
    return mAdapter.getViewTypeCount();
  }
  return 1;
}

代码示例来源:origin: consp1racy/android-support-preference

public int getViewTypeCount() {
  if (mAdapter != null) {
    return mAdapter.getViewTypeCount();
  }
  return 1;
}

代码示例来源:origin: com.albedinsky.android/ui-widget-adapter

/**
 */
@Override
public int getViewTypeCount() {
  return mAdapter.getViewTypeCount();
}

代码示例来源:origin: fire3/sailorcast

public int getViewTypeCount() {
  if (mAdapter != null) {
    return mAdapter.getViewTypeCount();
  }
  return 1;
}

代码示例来源:origin: MCMrARM/revolution-irc

@Override
public int getViewTypeCount() {
  return mWrapped.getViewTypeCount();
}

代码示例来源:origin: Meituan-Dianping/Shield

/**
 * Returns the number of types of Views that will be created by getView().
 */
@Override
public int getViewTypeCount() {
  int total = 0;
  for (ListAdapter piece : pieces) {
    total += piece.getViewTypeCount();
  }
  return (Math.max(total, 1)); // needed for setListAdapter() before
  // content add'
}

代码示例来源:origin: DF1E/SimpleExplorer

/**
 * Returns the number of types of Views that will be created by getView().
 */
@Override
public int getViewTypeCount() {
  int total = 0;
  for (ListAdapter piece : pieces) {
    total += piece.getViewTypeCount();
  }
  return Math.max(total, 1); // needed for setListAdapter() before
  // content add'
}

代码示例来源:origin: UweTrottmann/SeriesGuide

final int typeCount = adapter.getViewTypeCount();
if (typeCount != mSampleViewTypes.length) {
  mSampleViewTypes = new View[typeCount];

相关文章