Android Scroller - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Scroller class.

This code example shows how to use the following methods: computeScrollOffset, getCurrX, getCurrY
		return mCurScreen;
	} 
 
	@Override 
	public void computeScroll() { 
		if (mScroller.computeScrollOffset()) {
			scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
			postInvalidate();
		} 
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		//是否可滑动 
		if(!isScroll) {
			return false; 
		} 
		 
		if (mVelocityTracker == null) {
			mVelocityTracker = VelocityTracker.obtain();
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX, getCurrY
        init(); 
    } 
 
    @Override 
    public void computeScroll() { 
        if (scroller.computeScrollOffset()) {
            scrollTo(scroller.getCurrX(), scroller.getCurrY());
            postInvalidate();
        } else if (mNextScreen != INVALID_SCREEN) {
            mCurrentScreen = Math.max(0, Math.min(mNextScreen, getChildCount() - 1));
            if (listener != null) {
                listener.onScreenSwitch(mCurrentScreen);
            } 
            mNextScreen = INVALID_SCREEN;
        } 
    } 
 
    public int getCurrentScreen() { 
        return mCurrentScreen;
    } 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX
        return res;
    } 
 
    @Override 
    public void computeScroll() { 
        if (scroller.computeScrollOffset()) {
            setCurrentValue(scroller.getCurrX());
            invalidate();
        } else if (!inTouch) {
            zoomModel.commit();
        } 
    } 
 
    public float getCurrentValue() { 
        return (zoomModel.getZoom() - 1.0f) * MULTIPLIER;
    } 
 
    public void setCurrentValue(float currentValue) {
        if (currentValue < 0.0) {
            currentValue = 0.0f;
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX, getCurrY
    } 
 
    @Override 
    public void computeScroll() { 
 
        if (mScroller.computeScrollOffset()) {
            scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
            postInvalidate();
        } 
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent event) {
 
        if (!enableScroll) {
            return super.onTouchEvent(event);
        } 
        if (mVelocityTracker == null) {
            mVelocityTracker = VelocityTracker.obtain();
        } 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: abortAnimation, computeScrollOffset, getCurrX, getCurrY, startScroll
	 *  >0±íʾÔÚ×îԭʼµÄ»ù´¡ÉÏÏò×óÆ«ÒÆÁË <0 ±íʾÔÚ×îԭʼµÄ»ù´¡ÉÏÏòÓÒÆ«ÒÆÁË 
	 *  
	 */ 
	@Override 
	public void computeScroll() { 
		if (scroller.computeScrollOffset()) {
			int curX = scroller.getCurrX();
			this.scrollTo(curX, scroller.getCurrY());
			invalidate();// Ë¢ÐÂ
			Log.e("", "curX=" + curX);
			if (curX == -width && isMenuOpen) {
				scroller.abortAnimation();
				closeMenuPull02(); 
			} 
		} 
	} 
 
	/** 
	 * startScroll·½·¨ÓÐÎå¸ö²ÎÊý int startX ˮƽ·½Ïò¿ªÊ¼¹ö¶¯µÄÆ«ÒÆÖµ£¨Ïà¶ÔÓÚ×îԭʼµÄλÖã©£¬>0±íʾÏò×óÆ«ÒÆÁË£¬<0±íʾÏòÓÒÆ«ÒÆÁË 
	 * int startY, ͬÉÏ£¬´¹Ö±·½Ïò¡£ >0±íʾÏòÉÏÆ«ÒÆÁË int dx, ˮƽ·½ÏòÒƶ¯µÄ¾àÀ룬>0Ïò×óÆ«ÒÆ£¬<0ÏòÓÒÆ«ÒÆ int dy, 

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX, getCurrY
	} 
 
	@Override 
	public void computeScroll() { 
 
		if (mScroller.computeScrollOffset()) {
			scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
			postInvalidate();
		} 
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
 
		if (!enableScroll) {
			return super.onTouchEvent(event);
		} 
		if (mVelocityTracker == null) {
			mVelocityTracker = VelocityTracker.obtain();
		} 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX
        } 
        if (mBehindView == null) {
            mBehindView = findViewWithTag("Behind");
        } 
 
        if (mScroller.computeScrollOffset()) {
            int x = mScroller.getCurrX();
            if (x > 0) {
                x = x - (getMeasuredWidth()-mRightSpaceWidth);
            } 
            mWrapView.scrollTo(x, 0);
            postInvalidate();
        } 
    } 
 
    public void setBehindView(View view) {
        if (mBehindView != null) {
            removeView(mBehindView);
        } 
        mBehindView = view;
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, forceFinished, getCurrY, getFinalY, isFinished
    } 
     
    // animation handler 
    private Handler animationHandler = new Handler() {
        public void handleMessage(Message msg) { 
            scroller.computeScrollOffset(); 
            int currY = scroller.getCurrY(); 
            int delta = lastScrollY - currY; 
            lastScrollY = currY; 
            if (delta != 0) { 
                listener.onScroll(delta); 
            } 
             
            // scrolling is not finished when it comes to final Y 
            // so, finish it manually  
            if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) { 
                currY = scroller.getFinalY(); 
                scroller.forceFinished(true); 
            } 
            if (!scroller.isFinished()) { 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: computeScrollOffset, getCurrX
					getHeight());
		} 
	} 
 
	public void computeScroll() { 
		if (scroller.computeScrollOffset()) {
			scrollTo(scroller.getCurrX(), 0);
			postInvalidate();
		} 
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub 
		gestureDetector.onTouchEvent(event);
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			break; 
		case MotionEvent.ACTION_MOVE:
			break; 
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 */ 
	private boolean mIsLayoutDirty = true;
 
	public SimpleScrollView(Context context) {
		super(context);
		mScroller = new Scroller(context);
	} 
 
	@Override 
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
 
		final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
		if (widthMode == MeasureSpec.UNSPECIFIED) {
			return; 
		} 
 
		if (getChildCount() > 0) {
			final View child = getChildAt(0);
			int width = getMeasuredWidth();
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android Scroller Questions & Answers:

See Code Examples for Android Scroller Methods: