Android组件:Pinned-section-listview
jopen
11年前
类似系统联系人头部拼音推挤效果。
它实现的功能包括:
- Fast scroll
- Headers and footers
- Clickable pinned sections
用法:
-
Replace standard
ListView
withcom.hb.views.PinnedSectionListView
in yourlayout.xml
file.<com.hb.views.PinnedSectionListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content" />
-
Extend your
ListAdapter
in a way that it implementsPinnedSectionListAdapter
interface, in addition to what it already implements. Basically you need to add a singleisItemViewTypePinned(int viewType)
method. This method must returntrue
for all view types which have to be pinned.// Our adapter class implements 'PinnedSectionListAdapter' interface class MyPinnedSectionListAdapter extends BaseAdapter implements PinnedSectionListAdapter { ... // We implement this method to return 'true' for all view types we want to pin @Override public boolean isItemViewTypePinned(int viewType) { return viewType == <type to be pinned>; } }