fazhongxu / lbannerview Goto Github PK
View Code? Open in Web Editor NEWIBannerView
IBannerView
我是加载的网络图片,一共五个图片,首次进入默认竟然显示的是第4张图片,指示器又是指示第一个;滑动到第一张时下标显示的是3
感觉两张图片间距太小,怎么设置的大些
1、attrs中配置是否支持缩放isScale.
2、public class BannerTransformer implements ViewPager.PageTransformer {
private static final float MAX_SCALE = 1.1f;
private static final float MIN_SCALE = 0.9f;
@OverRide
public void transformPage(View page, float position) {
if (position < -1) {//(-Infinity,-1)
page.setScaleX(MIN_SCALE);
page.setScaleY(MIN_SCALE);
} else if (position <= 0) {//[-1,0]
float scaleFactor = MIN_SCALE+(1-Math.abs(position))(MAX_SCALE-MIN_SCALE);
page.setScaleX(scaleFactor);
page.setScaleY(scaleFactor);
} else if (position <= 1) {//(0,1]
float scaleFactor = MIN_SCALE+(1-Math.abs(position))(MAX_SCALE-MIN_SCALE);
page.setScaleX(scaleFactor);
page.setScaleY(scaleFactor);
} else {//(1,Infinity)
page.setScaleX(MIN_SCALE);
page.setScaleY(MIN_SCALE);
}
}
}
3、在BannerView.java 的initAttribute()获取isScale:
mIsScale=typedArray.getBoolean(R.styleable.BannerView_isScale, mIsScale);
在initView()中设置:
if(mIsScale){
mBannerViewPager.setPageTransformer(true, new BannerTransformer());
}
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.