Android組件:Pinned-section-listview
類似系統聯系人頭部拼音推擠效果。
它實現的功能包括:
- Fast scroll
- Headers and footers
- Clickable pinned sections </ul>
-
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>; } }
用法:
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!