本文整理匯總了Java中android.widget.ListView.getHeaderViewsCount方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.getHeaderViewsCount方法的具體用法?Java ListView.getHeaderViewsCount怎麽用?Java ListView.getHeaderViewsCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListView
的用法示例。
在下文中一共展示了ListView.getHeaderViewsCount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getViewHolderByIndex
import android.widget.ListView; //導入方法依賴的package包/類
public static Object getViewHolderByIndex(ListView listView, int index) {
int firstVisibleFeedPosition = listView.getFirstVisiblePosition() - listView.getHeaderViewsCount();
int lastVisibleFeedPosition = listView.getLastVisiblePosition() - listView.getHeaderViewsCount();
//隻有獲取可見區域的
if (index >= firstVisibleFeedPosition && index <= lastVisibleFeedPosition) {
View view = listView.getChildAt(index - firstVisibleFeedPosition);
Object tag = view.getTag();
return tag;
} else {
return null;
}
}
示例2: initView
import android.widget.ListView; //導入方法依賴的package包/類
private void initView() {
mListView = (ListView) findViewById(R.id.list_view);
stickyNavHostRoot = (StickyNavHost) findViewById(R.id.sticky_nav_layout);
stickyNavHostRoot.setVisibility(View.INVISIBLE);
View testHeaderView = LayoutInflater.from(this).inflate(R.layout.listview_head_view_test_layout, null);
mListView.addHeaderView(testHeaderView);
View inflateView = LayoutInflater.from(this).inflate(R.layout.sticky_nav_host_layout, null);
stickyNavHostHead = (StickyNavHost) inflateView.findViewById(R.id.sticky_nav_layout);
stickyNavHostHead.setVisibility(View.VISIBLE);
mListView.addHeaderView(stickyNavHostHead);
STICKY_POSITION_IN_HEADER = mListView.getHeaderViewsCount();
}
示例3: onListItemClick
import android.widget.ListView; //導入方法依賴的package包/類
@Override
public void onListItemClick(ListView listView, View view, int position, long id) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, listView, view, position, id);
if ((position+1) > listView.getHeaderViewsCount()) { /* Not a header. */
listener.onNoteClick(this, view, position, id, id);
} else {
if (mBook != null) {
listener.onBookPrefaceEditRequest(mBook);
} else {
Log.e(TAG, "Book null on preface edit request");
}
}
}