@@ -42,6 +42,7 @@ public class BannerView extends RelativeLayout {
42
42
private int mBulgeDistance = 25 ;//两边凸出距离
43
43
private int mBottomType = 0 ;//小点 文字描述位置 默认底部类型是小点覆盖在图片上) 0位覆盖在图片上 1是在底部图片下方
44
44
private boolean mScollFlag = false ;//滚动标记 标记是否设置过滚动
45
+ private int mPictureSpacing = 10 ; // 两张图片之间的间距
45
46
46
47
public BannerView (Context context ) {
47
48
this (context , null );
@@ -80,7 +81,7 @@ private void initView() {
80
81
LayoutParams layoutParams = (LayoutParams ) mBannerViewPager .getLayoutParams ();
81
82
layoutParams .setMargins (dip2px (mBulgeDistance ), 0 , dip2px (mBulgeDistance ), 0 );
82
83
mBannerViewPager .setLayoutParams (layoutParams );
83
- mBannerViewPager .setPageMargin (10 );//ViewPager页面之间的距离
84
+ mBannerViewPager .setPageMargin (mPictureSpacing );//ViewPager页面之间的距离
84
85
}
85
86
86
87
//手先判断是否是shape等drawable文件作为底部容器的背景,有的话就优先使用,没有的话判断是否传入了颜色值
@@ -126,6 +127,7 @@ private void initAttribute(AttributeSet attrs) {
126
127
//获取自定义属性,宽高比
127
128
mWidthProportion = (int ) typedArray .getFloat (R .styleable .BannerView_widthProportion , mWidthProportion );
128
129
mHeightProportion = (int ) typedArray .getFloat (R .styleable .BannerView_heightProportion , mHeightProportion );
130
+ mPictureSpacing = (int ) typedArray .getFloat (R .styleable .BannerView_pictureSpacing , mPictureSpacing );
129
131
mBulge = typedArray .getBoolean (R .styleable .BannerView_bulge , mBulge );
130
132
mBulgeDistance = typedArray .getInteger (R .styleable .BannerView_bulgeDistance , mBulgeDistance );
131
133
mBottomType = typedArray .getInt (R .styleable .BannerView_bottomType , mBottomType );
0 commit comments