Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglu1209 committed Oct 19, 2016
1 parent d14d8c8 commit 201de21
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,6 @@ public Banner setAdapter(BannerPagerAdapter adapter) {
mAdapter = adapter;
mPager.setAdapter(mAdapter);
mPager.setCurrentItem(mAdapter.size);
LinearLayout.LayoutParams dotParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
/**
* 未选中小圆点的间距
*/
dotParams.rightMargin = 12;
/**
* 创建未选中的小圆点
*/
for (int i = 0; i < mAdapter.size; i++) {
ImageView iv = new ImageView(mContext);
iv.setImageDrawable(mContext.getResources().getDrawable(mDot[0]));
iv.setLayoutParams(dotParams);
mDotGroup.addView(iv);
}

return this;
}
Expand Down Expand Up @@ -179,6 +163,24 @@ public Banner setDot(int... dots) {
post(new Runnable() {
@Override
public void run() {

LinearLayout.LayoutParams dotParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
/**
* 未选中小圆点的间距
*/
dotParams.rightMargin = 12;
/**
* 创建未选中的小圆点
*/
for (int i = 0; i < mAdapter.size; i++) {
ImageView iv = new ImageView(mContext);
iv.setImageDrawable(mContext.getResources().getDrawable(mDot[0]));
iv.setLayoutParams(dotParams);
mDotGroup.addView(iv);
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Message;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;

/**
Expand Down Expand Up @@ -53,6 +54,9 @@ public BannerViewPager setTime(int time) {

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if(ev.getAction() == MotionEvent.ACTION_OUTSIDE){
Log.d("112233", "ok");
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
stopAutoPlay();
} else if (ev.getAction() == MotionEvent.ACTION_UP) {
Expand Down

0 comments on commit 201de21

Please sign in to comment.