Android组件:Pinned-section-listview

jopen 11年前

类似系统联系人头部拼音推挤效果。

它实现的功能包括:

  • Fast scroll
  • Headers and footers
  • Clickable pinned sections

用法:

  1. Replace standard ListView with com.hb.views.PinnedSectionListView in your layout.xml file.

    <com.hb.views.PinnedSectionListView      android:id="@android:id/list"      android:layout_width="match_parent"      android:layout_height="wrap_content"       />
  2. Extend your ListAdapter in a way that it implements PinnedSectionListAdapter interface, in addition to what it already implements. Basically you need to add a single isItemViewTypePinned(int viewType) method. This method must return true 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>;       }  }

    Android组件:Pinned-section-listview  Android组件:Pinned-section-listview  Android组件:Pinned-section-listview

    项目主页:http://www.open-open.com/lib/view/home/1388495013531