一个实现 微星 手势滑屏效果 的源代码

时间:2015-01-26 19:09:21
【文件属性】:

文件名称:一个实现 微星 手势滑屏效果 的源代码

文件大小:141KB

文件格式:RAR

更新时间:2015-01-26 19:09:21

android 手势 滑屏 左右 翻屏

一个实现 微星 手势滑屏效果 的源代码 public class PagerControl extends View { private static final String TAG = "DeezApps.Widget.PagerControl"; private static final int DEFAULT_BAR_COLOR = 0xaa777777; private static final int DEFAULT_HIGHLIGHT_COLOR = 0xaa999999; private static final int DEFAULT_FADE_DELAY = 2000; private static final int DEFAULT_FADE_DURATION = 500; private int numPages, currentPage, position; private Paint barPaint, highlightPaint; private int fadeDelay, fadeDuration; private float ovalRadius; private Animation fadeOutAnimation; public PagerControl(Context context, AttributeSet attrs) { this(context, attrs, 0); } public PagerControl(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.com_deezapps_widget_PagerControl); int barColor = a.getColor(R.styleable.com_deezapps_widget_PagerControl_barColor, DEFAULT_BAR_COLOR); int highlightColor = a.getColor(R.styleable.com_deezapps_widget_PagerControl_highlightColor, DEFAULT_HIGHLIGHT_COLOR); fadeDelay = a.getInteger(R.styleable.com_deezapps_widget_PagerControl_fadeDelay, DEFAULT_FADE_DELAY); fadeDuration = a.getInteger(R.styleable.com_deezapps_widget_PagerControl_fadeDuration, DEFAULT_FADE_DURATION); ovalRadius = a.getDimension(R.styleable.com_deezapps_widget_PagerControl_roundRectRadius, 0f); a.recycle(); barPaint = new Paint(); barPaint.setColor(barColor); highlightPaint = new Paint(); highlightPaint.setColor(highlightColor); fadeOutAnimation = new AlphaAnimation(1f, 0f); fadeOutAnimation.setDuration(fadeDuration); fadeOutAnimation.setRepeatCount(0); fadeOutAnimation.setInterpolator(new LinearInterpolator()); fadeOutAnimation.setFillEnabled(true); fadeOutAnimation.setFillAfter(true); }


网友评论

  • 效果不错,但不是我要找的那种
  • 很好的资源,滑动效果做的也非常棒
  • 滑动效果不错
  • 很好的资源,滑动效果做的也非常棒 .
  • 很好的资源,滑动效果做的也非常棒