oubowu / pinnedsectionitemdecoration Goto Github PK
View Code? Open in Web Editor NEWA powerful ItemDecoration for Recyclerview, supports the common layoutmanager.
License: Apache License 2.0
A powerful ItemDecoration for Recyclerview, supports the common layoutmanager.
License: Apache License 2.0
https://github.com/supercwn/SuperRecycleView
这个项目,我自定义的adapter是这样的
public class SuperAdapter extends SuperBaseAdapter implements PinnedHeaderNotifyer
实现了PinnedHeaderNotifyer接口,但是运行时还是会报java.lang.IllegalStateException: Adapter must implements PinnedHeaderNotifyer这个错误。是因为继承的是SuperBaseAdapter的原因吗?
如题
在scrollview或者nestedscrollview里面不能使用
我是要做图书卷和章列表,数据是最外层list集合包含所有的卷,每一卷又是一个集合(包含该卷所有章节),这种可以用该库做嘛,有时间请回复我一下,谢谢。
RT
我用的是BaseRecyclerViewAdapterHelper的分组,但是不知道怎么实现悬停效果
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at java.util.ArrayList.get(ArrayList.java:310)
at com.chad.library.adapter.base.BaseMultiItemQuickAdapter.getDefItemViewType(BaseMultiItemQuickAdapter.java:35)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemViewType(BaseQuickAdapter.java:462)
at com.chad.library.adapter.base.listener.SimpleClickListener.isHeaderOrFooterPosition(SimpleClickListener.java:233)
at com.chad.library.adapter.base.listener.SimpleClickListener.access$300(SimpleClickListener.java:31)
at com.chad.library.adapter.base.listener.SimpleClickListener$ItemTouchHelperGestureListener.onLongPress(SimpleClickListener.java:160)
at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:809)
at android.view.GestureDetector.access$200(GestureDetector.java:46)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:305)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7237)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
这样删除增加一些数据吸顶的数据能更新吗
大神,请问初始化悬浮标题的时候可以获取到悬浮标题的子控件吗?然后给子控件设置一些属性
在使用BaseRecyclerviewAdapterHelper 2.4.4版本及以上时,重写onViewAttachedToWindow会报错
ambiguous method call.both
楼主可以试一下,最新BaseRecyclerviewadapterhelper.
使用楼主导入的BaseRecyclerviewadapterhelper版本没有问题
mHeaderItemDecoration = new PinnedHeaderItemDecoration.Builder(AdapterFootIndex.TYPE_PARENT)
.setDividerId(R.drawable.divider).enableDivider(true)
.setClickIds(R.id.item_ll_title)
.disableHeaderClick(false)
.setHeaderClickListener(clickAdapter).create();
recyclerView.addItemDecoration(mHeaderItemDecoration);
OnHeaderClickAdapter clickAdapter = new OnHeaderClickAdapter() {
@Override
public void onHeaderClick(View view, int id, int position) {
ToastUtil.showToast("tag=="+position);
}
};
悬浮的点击事件只有position==0的有效果,其他的就没有
如果在item适配器中自己加点击事件 那么 第一个悬浮没有点击事件 其他的都有
如题, 知道是绘制在界面之上导致的,但没有解决的思路
主要代码:
在fragment中:
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mHeaderItemDecoration = new
PinnedHeaderItemDecoration.Builder(IncomeAdapter.TYPE_STICKY_HEAD)
.disableHeaderClick(false).create();
mRecyclerView.addItemDecoration(mHeaderItemDecoration);
mAdapter = new IncomeAdapter(R.layout.item_income, R.layout.lv_pointrecord_header, mList);
mAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
mRecyclerView.setAdapter(mAdapter);
在Adapter中:
public class IncomeAdapter extends BaseSectionQuickAdapter<IncomeSection,BaseViewHolder> {
// public final static int TYPE_DATA = 1;
public static int TYPE_STICKY_HEAD = 1;
// public final static int TYPE_SMALL_STICKY_HEAD_WITH_DATA = 3;
public IncomeAdapter(int layoutResId, int sectionHeadResId, List data){
super(layoutResId, sectionHeadResId, data);
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
FullSpanUtil.onAttachedToRecyclerView(recyclerView, this, TYPE_STICKY_HEAD);
}
@Override
public void onViewAttachedToWindow(BaseViewHolder holder) {
super.onViewAttachedToWindow(holder);
FullSpanUtil.onViewAttachedToWindow(holder, this,TYPE_STICKY_HEAD );
}
@Override
protected void convertHead(BaseViewHolder helper, IncomeSection item) {
helper.setText(R.id.lv_pointrecord_date,item.header);
}
@Override
protected void convert(BaseViewHolder helper, IncomeSection item) {
Income income = item.t;
helper.setText(R.id.tv_Week, TimeUtils.dateToWeek(income.getIncome_time()));
helper.setText(R.id.tv_Time, income.getIncome_time());
helper.setText(R.id.tv_Income_desc, income.getIncome_desc());
helper.setText(R.id.tv_Income_money, "¥"+income.getIncome_monery()+"元");
}
实体类:
public class IncomeSection extends SectionEntity {
private List<Income> items;
// public static final int TYPE_HEADER = 1;
// public static final int TYPE_DATA = 2;
public IncomeSection(boolean isHeader, String header) {
super(isHeader, header);
items = new ArrayList<>();
}
public IncomeSection(Income income) {
super(income);
items = new ArrayList<>();
}
public void addIncome(Income item) {
this.items.add(item);
}
public List<Income> getItems() {
return items;
}
}
求教大佬,谢谢
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6687)
at com.oushangfeng.pinnedsectionitemdecoration.PinnedHeaderItemDecoration.createPinnedHeader(PinnedHeaderItemDecoration.java:298)
at com.oushangfeng.pinnedsectionitemdecoration.PinnedHeaderItemDecoration.onDraw(PinnedHeaderItemDecoration.java:147)
头部如果是list的话,无法滑动无法点击。
滚动到顶部,RecyclerView 的 edge ripple 效果会被 pinned header 覆盖,给的 demo 中 BigPinnedHeader 中也存在这个问题,StockActivity 没有这个问题,因为往 adapter 中添加了一个 headerView,就不存在这个问题了。??
如果 PinnedHeaderItemDecoration 不添加 divider,存在一像素(或 1dp?)的边缘情况,会导致 pinned header 显示的是上一个 header 的内容。
如何让头部有阴影效果,像这个一样PinnedSectionListview,地址https://github.com/beworker/pinned-section-listview
我看了你的demo 是以BaseMultiItemQuickAdapter多布局Adapter的...如果以Section来的话是怎样添加进去?
非常棒的一个库,开发中遇到一个问题,项目中让做的效果图如下:
左侧菜单点击可以快速定位该分类到顶部,右侧分类滑出该分类则左侧菜单切换到相应分类,想问下,该库中是否支持滑动监听,或者有什么思路,望提供,谢谢!
1.点击/长按Header会有振动反馈,可以去掉么?
2.点击Header的手势事件会传递一个ACTION_DOWN到下面的RecyclerView上
旋转屏幕时,第一个粘性头部不绘制(宽度占不了整屏宽度),滑动至第二个分类位置时,第一个才恢复正常.
RT,只有在下一个标签和上一个标签在一起的时候,点击事件才有效。
怎么实现ExpandRecyclerView那样点击悬浮头部可扩展收起
Header not removed if data in adapter exist and then set to empty
become
Snippet code at the end of onCreate() method on MainActivity in example
private void removeData() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
removeDataAndUpdateAdapter();
}
}, 5000);
}
private void removeDataAndUpdateAdapter() {
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.setNewData(new ArrayList<PinnedHeaderEntity<Integer>>());
mAdapter.notifyDataSetChanged();
}
});
}
The first pinned section does not support RTL
The snippet code for item_pinned_header.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--android:padding="2dp"-->
<TextView
android:id="@+id/tv_animal"
android:background="#5A5A5A"
tools:text="熊猫"
android:gravity="start"
android:textSize="18dp"
android:padding="8dp"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>```
如题..
RT,头部子控件的点击事件无法扑捉,只有点击整个头部的事件,无法定位到具体的。而且DEMO本身也是无法正常点击头部子控件的。像那个more的点击事件。
配合加载更多使用时候,底部的loadingView没有显示,应该是在10条数据之下,会不会是加多个sticky布局高度算进去了 我的sticky高度刚好为45dp与BaseRecyclerViewAdapterHelper加载更多View一样,请问下是框架支持问题还是我使用错了?谢谢
我看下了源码中的方法,没有找到快速通过头部的数据定位到相应头部的方法,请问有吗?、谢谢
能否添加该功能呢?
感觉这个不是完全的分组,,
在几个粘性库中, 都没有解决这个问题 ~
加了jcenter() https://jitpack.io 找不到这个包, 改成'com.github.oubowu:PinnedSectionItemDecoration:-SNAPSHOT' 能下载到
当其他悬浮条目顶上来之后会改变checkbox状态,我把、
// 刷新ItemDecorations,导致重绘刷新头部
//mRecyclerView.invalidateItemDecorations();
这个注释掉也不行,不知道是不是可以解决这个问题
粘性头部可以设置的像其它item一样上滑消失吗,有没有一个参数可以让粘性头部可以粘住也可以划走?,还有这个粘性头部支持复杂的布局吗,像播放视频
非常感谢,如果能够提供帮助呢!!
onHeaderClick点击响应明显比其他没有置顶悬浮的响应慢
STACK_TRACE=java.lang.ArrayIndexOutOfBoundsException: length=11; index=-1 at android.util.SparseArray.keyAt(SparseArray.java:280) at com.oushangfeng.pinnedsectionitemdecoration.callback.OnItemTouchListener.shouldIntercept(OnItemTouchListener.java:144) at com.oushangfeng.pinnedsectionitemdecoration.callback.OnItemTouchListener.access$400(OnItemTouchListener.java:17) at com.oushangfeng.pinnedsectionitemdecoration.callback.OnItemTouchListener$GestureListener.onDoubleTap(OnItemTouchListener.java:225) at android.view.GestureDetector.onTouchEvent(GestureDetector.java:563) at com.oushangfeng.pinnedsectionitemdecoration.callback.OnItemTouchListener.onInterceptTouchEvent(OnItemTouchListener.java:84) at android.support.v7.widget.RecyclerView.dispatchOnItemTouchIntercept(RecyclerView.java:2572) at android.support.v7.widget.RecyclerView.onInterceptTouchEvent(RecyclerView.java:2618) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:411) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1810) at android.app.Activity.dispatchTouchEvent(Activity.java:3061) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:373) at android.view.View.dispatchPointerEvent(View.java:10234) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4447) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4308) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3855) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3908) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3874) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4001) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3882) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4058) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3855) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3908) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3874) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3882) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3855) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6225) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6199) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6160) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6328) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:323) at android.os.Looper.loop(Looper.java:151) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.