xuezj / CardBannerDemo

34 stars 4 forks source link

怎么往回滑动到初始位置,不能再滑动了,能否无限回滑呢?无限下滑可以 #1

Open Ellen2018 opened 6 years ago

xuezj commented 6 years ago

里面的原理是利用整形最大值作为适配器的数量大小,你是怎么滑到头的

itzhaokun commented 6 years ago

第一次进去默认就是第一张图片往左滑动就到头了

xuezj commented 6 years ago

只有一张图吗?

itzhaokun commented 6 years ago

4张图,现在可以往左滑动了,有时候在运行中和第一次加载会报错 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()' on a null object reference at com.xuezj.cardbanner.view.CardView.findViewAtCenter(CardView.java:163) at com.xuezj.cardbanner.view.CardView.onLayout(CardView.java:67) 你能看下这个错误吗

xuezj commented 6 years ago

我正在改这个问题

itzhaokun commented 6 years ago

好的,感谢

xuezj commented 6 years ago

这回应该好了

itzhaokun commented 6 years ago

java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)" at com.bumptech.glide.Glide.initializeGlide(Glide.java:230) at com.bumptech.glide.Glide.checkAndInitializeGlide(Glide.java:171) at com.bumptech.glide.Glide.get(Glide.java:155) at com.bumptech.glide.Glide.getRetriever(Glide.java:528) at com.bumptech.glide.Glide.with(Glide.java:554) at com.xuezj.cardbanner.adapter.CardAdapter.onBindViewHolder(CardAdapter.java:82) at com.xuezj.cardbanner.adapter.CardAdapter.onBindViewHolder(CardAdapter.java:18) at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6482) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6515) at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5458) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5724) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559) glide报错了,看一下

itzhaokun commented 6 years ago

@GlideModule public class MyAppGlideModule extends AppGlideModule {

@Override
public boolean isManifestParsingEnabled() {
    return false;
}

} 创建这个类。重写这个方法就好了,改一下吧

xuezj commented 6 years ago

你是不是自己也引用Glide了

itzhaokun commented 6 years ago

是的,有什么冲突吗?

itzhaokun commented 6 years ago

嗯,这个问题我在项目中解决了