Git Product home page Git Product logo

Comments (6)

oubowu avatar oubowu commented on September 23, 2024

改到2.4.4了,只是泛型多了个K extend BaseViewHolder,调整了下发现没有问题啊,你能把你的代码贴下么?我的adapter都会重写onViewAttachedToWindow的,没有报错 @liuyuttkx

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on September 23, 2024

代码更新到v2.6.1了,你拉下再试试? @liuyuttkx

from pinnedsectionitemdecoration.

liuyuttkx avatar liuyuttkx commented on September 23, 2024

您好,最终测试发现是我用的studio软件误报. 报错后仍然编译正常运行. (第一次发现会出现这样)但"holder"代码那块一直会报红.
我用的都是线性布局,索性我也不用重写那两个方法. 事情完成解决.
十分感谢楼主!!!!
报错代码如下,报错点在"holder"这里.
@OverRide
public void onViewAttachedToWindow(BaseViewHolder holder) {
super.onViewAttachedToWindow(holder);
FullSpanUtil.onViewAttachedToWindow(holder, this, StockEntity.StockInfo.TYPE_HEADER);
}

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on September 23, 2024

FullSpanUtil.onViewAttachedToWindow(holder, this, StockEntity.StockInfo.TYPE_HEADER)
如果是瀑布流布局,这里处理标签的布局占满一行

原因我可能知道了,它的父方法调用了这个
` public void onViewAttachedToWindow(K holder) {
super.onViewAttachedToWindow(holder);
int type = holder.getItemViewType();
if(type != 1365 && type != 273 && type != 819 && type != 546) {
this.addAnimation(holder);
} else {
this.setFullSpan(holder);
}

}

protected void setFullSpan(ViewHolder holder) {
    if(holder.itemView.getLayoutParams() instanceof LayoutParams) {
        LayoutParams params = (LayoutParams)holder.itemView.getLayoutParams();
        params.setFullSpan(true);
    }

}`

然后我再重写的时候super.onViewAttachedToWindow(holder); 所以方法调用两次了,居然会报错~~~

所以你去掉也没问题,但是你不能保证其他框架适配器有做这个吧,所以你看个人情况加咯

from pinnedsectionitemdecoration.

liuyuttkx avatar liuyuttkx commented on September 23, 2024

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on September 23, 2024

BaseQuickAdapter不是我写的 其实这里用这个适配器只是方便演示 只要实现任意适配器就行 根据实际情况处理即可

from pinnedsectionitemdecoration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.