Java Code Examples for android.widget.AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER

The following are Jave code examples for showing how to use ITEM_VIEW_TYPE_HEADER_OR_FOOTER of the android.widget.AdapterView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: aos-Video   File: HeaderGridView.java   View Source Code Vote up 6 votes
@Override
public int getItemViewType(int position) {
    int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
    if (position < numHeadersAndPlaceholders && (position % mNumColumns != 0)) {
        // Placeholders get the last view type number
        return mAdapter != null ? mAdapter.getViewTypeCount() : 1;
    }
    if (mAdapter != null && position >= numHeadersAndPlaceholders) {
        int adjPosition = position - numHeadersAndPlaceholders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }
    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example 2
Project: MyAnimeViewer   File: HeaderGridView.java   View Source Code Vote up 6 votes
@Override
public int getItemViewType(int position) {
    int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
    if (position < numHeadersAndPlaceholders && (position % mNumColumns != 0)) {
        // Placeholders get the last view type number
        return mAdapter != null ? mAdapter.getViewTypeCount() : 1;
    }
    if (mAdapter != null && position >= numHeadersAndPlaceholders) {
        int adjPosition = position - numHeadersAndPlaceholders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }
    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example 3
Project: exciting-app   File: HeaderViewListAdapter.java   View Source Code Vote up 5 votes
@Override
public int getItemViewType(int position) {
	int numHeaders = getHeadersCount();
	if (mAdapter != null && position >= numHeaders) {
		int adjPosition = position - numHeaders;
		int adapterCount = mAdapter.getCount();
		if (adjPosition < adapterCount) {
			return mAdapter.getItemViewType(adjPosition);
		}
	}

	return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}