Skip to content

Commit

Permalink
修复Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglu1209 committed Sep 22, 2016
1 parent ed2a054 commit bff9f02
Show file tree
Hide file tree
Showing 6 changed files with 3,717 additions and 28 deletions.
8 changes: 1 addition & 7 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,7 @@ private void init() {
*/
addView(mFrameLayout, params);

/**
* 添加到任务栈,当前所有任务完事之后添加已经选中的那个小圆点
*/
post(new Runnable() {
@Override
public void run() {
ImageView iv = new ImageView(mContext);
iv.setImageDrawable(mContext.getResources().getDrawable(mDot[1]));
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
/**
* 设置选中小圆点的左边距
*/
params.leftMargin = (int) mDotGroup.getChildAt(0).getX();
params.gravity = Gravity.BOTTOM;
mFrameLayout.addView(iv, params);
mSelectedDot = mFrameLayout.getChildAt(1);
}
});

mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
Expand Down Expand Up @@ -190,6 +173,24 @@ public Banner setTime(int time) {
public Banner setDot(int... dots) {
mDot[0] = dots[0];
mDot[1] = dots[1];
/**
* 添加到任务栈,当前所有任务完事之后添加已经选中的那个小圆点
*/
post(new Runnable() {
@Override
public void run() {
ImageView iv = new ImageView(mContext);
iv.setImageDrawable(mContext.getResources().getDrawable(mDot[1]));
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
/**
* 设置选中小圆点的左边距
*/
params.leftMargin = (int) mDotGroup.getChildAt(0).getX();
params.gravity = Gravity.BOTTOM;
mFrameLayout.addView(iv, params);
mSelectedDot = mFrameLayout.getChildAt(1);
}
});
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public BannerViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}


public BannerViewPager startAutoPlay() {
mHandler.sendEmptyMessageDelayed(MSG_WHAT, SEND_TIME);
return this;
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Loading

0 comments on commit bff9f02

Please sign in to comment.