FamiliarRecyclerView
????????ListView?GridView?????RecyclerView???????????ListView / GridView??????RecyclerView????????????ListView / GridView / ??? ???RecyclerView????????.
???
gradle
compile 'com.github.iwgang:familiarrecyclerview:1.3.3'
?????????
// ??/?? ??View (????) mRecyclerView.addHeaderView() ? .removeHeaderView() // ??/?? ??View (????) mRecyclerView.addFooterView() ? .removeFooterView() // ??????????????????????Divider???????????????????????? mRecyclerView.setDivider() ???????????????????????????Divider?????? // ?????View???isRetainShowHeadOrFoot?true???????EmptyView?????????HeadView?FooterView? mRecyclerView.setEmptyView() // Item???? mRecyclerView.setOnItemClickListener(new FamiliarRecyclerView.OnItemClickListener() {
@Override
public void onItemClick(FamiliarRecyclerView familiarRecyclerView, View view, int position) {
// ...
}
}
);
// Item???? mRecyclerView.setOnItemLongClickListener(new FamiliarRecyclerView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(FamiliarRecyclerView familiarRecyclerView, View view, int position) {
return true;
}
}
);
// ???????????????? mRecyclerView.setOnScrollListener(new FamiliarRecyclerViewOnScrollListener(mRecyclerView.getLayoutManager()) {
@Override
public void onScrolledToTop() {
// top
}
@Override
public void onScrolledToBottom() {
// bottom
}
}
);
????? ??Adapter ???????DataBinding????Adapter
mAdapter = new FamiliarEasyAdapter<UserInfo>(this, R.layout.item_view, data) {
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
TextView tvName = holder.findView(R.id.tv_name);
tvName.setText(mAdapter.getData(position).getName());
}
}
; ?... ???RecyclerView??????????????
??
// LinearLayout ?ListView? <cn.iwgang.familiarrecyclerview.FamiliarRecyclerView
android:id="@+id/mRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:frv_divider="#696969"
app:frv_dividerHeight="1dp"
app:frv_emptyView="@id/tv_empty"
app:frv_layoutManager="linear"
app:frv_layoutManagerOrientation="vertical" />
// GridLayout ?GridView? <cn.iwgang.familiarrecyclerview.FamiliarRecyclerView
android:id="@+id/mRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:frv_dividerHorizontal="#FFEE00"
app:frv_dividerVertical="#FFCCDD"
app:frv_dividerHorizontalHeight="10dp"
app:frv_dividerVerticalHeight="30dp"
app:frv_itemViewBothSidesMargin="20dp"
app:frv_layoutManager="grid"
app:frv_layoutManagerOrientation="vertical"
app:frv_spanCount="3" />
// StaggeredGridLayout ????? <cn.iwgang.familiarrecyclerview.FamiliarRecyclerView
android:id="@+id/mRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:frv_divider="#EFADEF"
app:frv_dividerHorizontalHeight="10dp"
app:frv_dividerVerticalHeight="10dp"
app:frv_itemViewBothSidesMargin="20dp"
app:frv_layoutManager="staggeredGrid"
app:frv_layoutManagerOrientation="vertical"
app:frv_spanCount="2" />
???? + ????
?1.3.0?????????FamiliarRefreshRecyclerView???????????? ????????
// ?? ?FamiliarRecyclerView?????????List?Gird?staggeredGrid????? <cn.iwgang.familiarrecyclerview.FamiliarRefreshRecyclerView
android:id="@+id/cv_refreshListRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:frv_divider="#333333"
app:frv_dividerHeight="0.5dp"
app:frv_emptyView="@id/tv_empty"
app:frv_isEmptyViewKeepShowHeadOrFooter="true"
app:frv_layoutManager="linear"
app:frv_layoutManagerOrientation="vertical" /> // ?????? mCvRefreshListRecyclerView.setOnPullRefreshListener(...) // ?????? mCvRefreshListRecyclerView.setOnLoadMoreListener(...) // ???????View mCvRefreshListRecyclerView.setLoadMoreView(...) // ????/?????? mCvRefreshListRecyclerView.setLoadMoreEnabled(true / false);
// ????/?????? mCvRefreshListRecyclerView.setPullRefreshEnabled(true / false);
?????
?? | ?? | ??? | ?? |
---|---|---|---|
frv_divider | reference / color | ? | ?????divider |
frv_dividerVertical | reference / color | ? | ?????divider |
frv_dividerHorizontal | reference / color | ? | ?????divider |
frv_dividerHeight | dimension | 1px | ?????size |
frv_dividerVerticalHeight | dimension | 1px | ?????size |
frv_dividerHorizontalHeight | dimension | 1px | ?????size |
frv_isNotShowGridEndDivider | boolean | false | ?????Grid??item???? |
frv_itemViewBothSidesMargin | dimension | ? | itemView??????????headerView?footerView???? |
frv_emptyView | reference | ? | emptyView id |
frv_isEmptyViewKeepShowHeadOrFooter | boolean | false | ??EmptyView????????????HeadView?FooterView |
frv_layoutManager | linear / grid / staggeredGrid | ? | ???? |
frv_layoutManagerOrientation | horizontal / vertical | vertical | ???? |
frv_spanCount | integer | 2 | ?????frv_layoutManager=grid / staggeredGrid??? |
frv_headerDividersEnabled | boolean | false | ????headView????? |
frv_footerDividersEnabled | boolean | false | ????footerView????? |