本文整理汇总了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");
}
}
}