androiddevelop / cycleviewpager Goto Github PK
View Code? Open in Web Editor NEW循环滚动,自动播放的ViewPager
Home Page: http://codeboy.me
License: Apache License 2.0
循环滚动,自动播放的ViewPager
Home Page: http://codeboy.me
License: Apache License 2.0
布局上添加图片以后,当滑动到临界位置进行切换时,会有小小的跳动动画。
无限循环时效果不是非常完美。
不完美处在这里
@OverRide
public void onPageSelected(int position) {
curPosition = position;
if (curPosition == list.size() - 1 || curPosition == 0) {
final int newReplacePosition = getRealPosition(curPosition);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
viewPager.setCurrentItem(newReplacePosition,false);
}
},250);
}
}
考虑到兼容性,为什么不是继承自v4包中的Fragment
在android studio中加上
compile 'me.codeboy.android:cycle-view-pager:2.0.0'
然后报错:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@label value=(@string/app_name) from AndroidManifest.xml:8:9-41
is also present at [me.codeboy.android:cycle-view-pager:2.0.0] AndroidManifest.xml:13:9-58 value=(@string/cycle_view_pager_app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:5:5-19:19 to override.
请问你这个轮播为啥要支持4.0以上才行呢?
List views = new ArrayList();
ImageView iv0 = new ImageView(getActivity().getApplicationContext());
iv0.setImageBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.image0));
ImageView iv1 = new ImageView(getActivity().getApplicationContext());
iv1.setImageBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.image1));
ImageView iv2 = new ImageView(getActivity().getApplicationContext());
iv2.setImageBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.image2));
ImageView iv3 = new ImageView(getActivity().getApplicationContext());
iv3.setImageBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.image3));
views.add(iv3);
views.add(iv0);
views.add(iv1);
views.add(iv2);
views.add(iv3);
views.add(iv0);
CycleViewPager cycleViewPager =fragmentTuijianBinding.cycleViewPager;
//循环+轮播,3000ms自动切换
cycleViewPager.setData(views, true, true, 3000);
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.