本文整理匯總了Java中android.widget.Adapter.getItemViewType方法的典型用法代碼示例。如果您正苦於以下問題:Java Adapter.getItemViewType方法的具體用法?Java Adapter.getItemViewType怎麽用?Java Adapter.getItemViewType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.Adapter
的用法示例。
在下文中一共展示了Adapter.getItemViewType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getItemViewType
import android.widget.Adapter; //導入方法依賴的package包/類
@Override
public int getItemViewType(int position)
{
int type = 1;
for (final Object section : sectionMap.keySet())
{
final Adapter adapter = sectionMap.get(section);
final int size = adapter.getCount() + (hasSectionHeader ? 1 : 0);
if (position == 0 && hasSectionHeader)
return TYPE_SECTION_HEADER;
if (position < size)
return type + adapter.getItemViewType(position - 1);
position -= size;
type += adapter.getViewTypeCount();
}
return -1;
}
示例2: getItemViewType
import android.widget.Adapter; //導入方法依賴的package包/類
@Override
public int getItemViewType(int position) {
int type = 1;
for (Object section : this.sections.keySet()) {
Adapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0) return TYPE_SECTION_HEADER;
if (position < size) return type + adapter.getItemViewType(position - 1);
// otherwise jump into next section
position -= size;
type += adapter.getViewTypeCount();
}
return -1;
}
示例3: getItemViewType
import android.widget.Adapter; //導入方法依賴的package包/類
public int getItemViewType(int position) {
int type = 1;
for(Object section : this.sections.keySet()) {
Adapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if(position == 0) return TYPE_SECTION_HEADER;
if(position < size) return type + adapter.getItemViewType(position - 1);
// otherwise jump into next section
position -= size;
type += adapter.getViewTypeCount();
}
return -1;
}