youth5201314 / banner Goto Github PK
View Code? Open in Web Editor NEW🔥🔥🔥Banner 2.0 来了!Android广告图片轮播控件,内部基于ViewPager2实现,Indicator和UI都可以自定义。
License: Apache License 2.0
🔥🔥🔥Banner 2.0 来了!Android广告图片轮播控件,内部基于ViewPager2实现,Indicator和UI都可以自定义。
License: Apache License 2.0
如题,当你一开始在第一张图片的时候,手指右滑到最后一张图片,等到图片轮播器自动轮播的时候,动画效果就没有了
在android studio 画界面的时候就报这个错误android.support.v4.view.ViewPager cannot be cast to com.youth.banner.view.BannerViewPager
compile 'com.youth.banner:banner:1.4.1' //最新版本加入后报属性冲突,请解决一下!
banner嵌入listview后滑动是与下拉刷新框架(XRefreshView)冲突
自动轮播的的时候 重新回到的第一个的时候,视图有明显伸拉了一下,有闪动····不知道别人会不会出现这情况·····
1、增加设置是否自动轮播
2、增加指示器位置设置
在startplay的时候增加handler.removecallback(task)
在createIndicator()时增加 indicatorImages.clear()和 indicator.removeAllViews();
把banner添加到recyclerview中的一个viewtype中。下拉后返回顶部。banner翻页速度会非常快,直接无动画切换效果了,另外使用WeakReference fix会检测出 内存泄漏问题
项目中产品可能要求的不是原点指示器,而是其他的
我用compile 'com.youth.banner:banner:+'方式集成,然后代码里面写
String[] images = getResources().getStringArray(R.array.url); Banner banner = (Banner) findViewById(R.id.home_banner); banner.setImages(images);
但是图片显示不出来,不知道为什么
Hi 作者,
剛剛試用了一下,發現有時首頁和尾頁在手動滑動時有時會卡住不動一下下...
條件是:首頁要往右滑時,尾頁要往左滑時
数字指示器
设置颜色没用,总是显示白色
app:rollviewpager_hint_color="#000"
为什么要从1开始计数呢,而且不显示第0页
建议是否轮播使用handle 的 remove runable实现
1、createIndicator中应初始化指示点,默认第一个显示颜色,防止第一次时下边什么都不显示
if(i==0){
imageView.setImageResource(mIndicatorSelectedResId);
}else{
imageView.setImageResource(mIndicatorUnselectedResId);
}
2、onPageSelected中判断条件有误,当position==0或position==indicatorImages.size()+1时
for循环中都为false造成延迟加载,if中的判断条件应改为
i== (position - 1+indicatorImages.size())%indicatorImages.size()
public void setScrollerTime(int duration) {
this.duration = duration;
} 设置了滚动时间后,首次轮播 第一张到第二张图片的滚动时间还是默认时间
就是我手指先在banner上左右滑动,然后再上下滑动,如果我的布局中有下拉刷新的时候,下拉刷新也会出来,我想能不能让banner在我手动左右滑动的时候,消费掉这个事件,不让它的父布局处理
我用glide加载drawable里的资源文件报错,看你的demo中是直接加载网络图片,没有加载资源文件里的图片
第一张图过了好久才会加载出来 会出现大概两三秒的空白,第二张图都出来了第一张还是有问题
作者你好,我把banner作为gridview的header加进去,切换时没有了滑动的效果,求解。
可以加入过渡动画吗,比如淡入淡出那种,就是从默认图片转换成需要的图片的时候显示动画效果
现在碰到个问题,banner开始滚动后,手指触摸baner把图片左右滑动一下,然后离开屏幕,滚动就停止了,必须重新click图片一下才会再次滚动
应为 有可能需要下拉刷新 但是 左右滑动banner 会和 下拉刷新 有点点冲突,所以有必要 监听 左右滑动的时候 关闭下拉刷新。。。。
banner左右快速滑动,比如从最后一页到第一页会出现屏幕掉帧的情况,不知道什么原因。再提个小需求,貌似不能让banner停止轮播吧,调用了stopautoplay,然后手滑,banner又开始主动轮播了。。。
我的请求数据是个list,里面有图片地址和对应的标题,但是发现用这个只能加载图标,你的标题的方法是个数组,是否可以增加个List类型的
我把网络关了,还是一片空白没有显示默认图片
Caused by: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
at com.bumptech.glide.d.l.b(SourceFile:134)
at com.bumptech.glide.d.l.a(SourceFile:102)
at com.bumptech.glide.d.l.a(SourceFile:87)
at com.bumptech.glide.e.b(SourceFile:629)
at com.tclmobile.personalfinance.widget.banner.Banner.a(SourceFile:278)
at com.tclmobile.personalfinance.widget.banner.Banner.setImages(SourceFile:227)
at com.tclmobile.personalfinance.view.a.af.O(SourceFile:871)
at com.tclmobile.personalfinance.view.a.af.c(SourceFile:372)
at com.tclmobile.personalfinance.f.a.s.a(SourceFile:52)
at com.tclmobile.personalfinance.d.b.aw.onError(SourceFile:122)
at rx.observers.SafeSubscriber._onError(SourceFile:157)
at rx.observers.SafeSubscriber.onError(SourceFile:120)
at
偶尔会有异常10-13 10:05:46.392: E/AndroidRuntime(7843): java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
10-13 10:05:46.392: E/AndroidRuntime(7843): at com.fragment.DynamicAllFrag$4.OnBannerClick(DynamicAllFrag.java:186)
既然都考虑到了自定义图片加载框架,就可以把 Glide 依赖剥离,作为一个实现方案。如果我希望利用 Fresco 加载图片,那多依赖一个 Glide 就会很不爽。
类似于 Retrofit 的 converter 和 adapter,Retrofit 本身是不包含 Gson,RxJava 这些依赖的。
to author:
one advice:
use “provided 'com.android.support:appcompat-v7:23.1.1'”
当用手指朝一个放向滑动banner的时候,多滑几下,会出现卡住,划不动的情况。
我的banner 有三张图,下拉刷新时 后台改变了 第二张第三章的顺序,发现banner 第二张图片和第三张图片重复了
我发现当banner不可见的时候,其实他还是一直在自动轮播的,是否可以对这方面进行一些处理,让他在不可见的时候不再自动轮播,等再次可见的时候继续轮播?
请教个问题,这个可以自定义么?我想在每个图片上面加个标签,这个怎么实现呢?还有想换指示器样式
轮播时用带文字的形式,文字和指示圆圈横向排列,点击下侧文字的position和点击图片的position不一致,点击文字的是正确的,而点图片的是乱的,麻烦看一下
当左滑到倒数第一张图片的时候,接下来需要显示第一张图片,发现过渡效果有点直接 0.0
好像是找不到id.不过看了代码layout文件里又这个id,换换1.2.1之后就正常了...
比如3张图,我设置时间间隔1s,但是每次到第一张之后都要多停留几秒
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.