Java Code Examples for android.view.View.scrollTo()

The following are Jave code examples for showing how to use scrollTo() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File: DrawerLayout.java   Source Code and License Vote up 6 votes
public void closeDrawer() {
    View menuView = mLeftMenuView;

    menuView.scrollTo(-menuView.getWidth(), menuView.getTop());
    invalidate();
    mLeftMenuOnScrren = 0.0f;
}
 
Example 2
Project: GitHub   File: DrawerLayout.java   Source Code and License Vote up 6 votes
public void openDrawer() {

        View menuView = mLeftMenuView;
        menuView.scrollTo(0, menuView.getTop());
        mLeftMenuOnScrren = 1.0f;

        invalidate();
        isDrawerOpen = true;
    }
 
Example 3
Project: LuaViewPlayground   File: UDView.java   Source Code and License Vote up 6 votes
/**
 * 滚动到某个位置
 *
 * @param x
 * @param y
 * @return
 */
public UDView scrollTo(final int x, final int y) {
    final View view = getView();
    if (view != null) {
        view.scrollTo(x, y);
    }
    return this;
}
 
Example 4
Project: Hotspot-master-devp   File: SwipeListView.java   Source Code and License Vote up 6 votes
@Override
public void handleMessage(Message msg) {
	super.handleMessage(msg);
	if (stepX == 0) {
		if (mIsInAnimation) {
			return;
		}
		mIsInAnimation = true;
		view = (View) msg.obj;
		fromX = msg.arg1;
		toX = msg.arg2;
		stepX = (int) ((toX - fromX) * mDurationStep * 1.0 / mDuration);
		if (stepX < 0 && stepX > -1) {
			stepX = -1;
		} else if (stepX > 0 && stepX < 1) {
			stepX = 1;
		}
		if (Math.abs(toX - fromX) < 10) {
			view.scrollTo(toX, 0);
			animatioOver();
			return;
		}
	}

	fromX += stepX;
	boolean isLastStep = (stepX > 0 && fromX > toX)
			|| (stepX < 0 && fromX < toX);
	if (isLastStep) {
		fromX = toX;
	}

	view.scrollTo(fromX, 0);
	invalidate();

	if (!isLastStep) {
		this.sendEmptyMessageDelayed(0, mDurationStep);
	} else {
		animatioOver();
	}
}
 
Example 5
Project: garras   File: AnchorSheetBehavior.java   Source Code and License Vote up 6 votes
/**
 * Sets the state of the bottom sheet. The bottom sheet will transition to that state with
 * animation.
 *
 * @param state One of {@link #STATE_COLLAPSED}, {@link #STATE_EXPANDED}, or
 *              {@link #STATE_HIDDEN}.
 */
public final void setState(@State int state) {
    if (state == mState) {
        return;
    }
    if (mViewRef == null) {
        // The view is not laid out yet; modify mState and let onLayoutChild handle it later
        if (state == STATE_COLLAPSED || state == STATE_EXPANDED || state == STATE_ANCHOR ||
                (mHideable && state == STATE_HIDDEN)) {
            mState = state;
        }
        return;
    }
    V child = mViewRef.get();
    if (child == null) {
        return;
    }
    int top;
    if (state == STATE_COLLAPSED) {
        top = mMaxOffset;
        View scroll = mNestedScrollingChildRef.get();
        if (scroll != null && ViewCompat.canScrollVertically(scroll, -1)) {
            scroll.scrollTo(0, 0);
        }
    } else if (state == STATE_EXPANDED) {
        top = mMinOffset;
    } else if (state == STATE_ANCHOR) {
        top = mAnchorOffset;
    } else if (mHideable && state == STATE_HIDDEN) {
        top = mParentHeight;
    } else {
        throw new IllegalArgumentException("Illegal state argument: " + state);
    }
    setStateInternal(STATE_SETTLING);
    if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) {
        ViewCompat.postOnAnimation(child, new SettleRunnable(child, state));
    }
}
 
Example 6
Project: YCSlideView   File: SlideViewHolder.java   Source Code and License Vote up 6 votes
public void onBindSlide(View targetView) {
    switch (mSlideAnimationHelper.getState()) {
        case SlideAnimationHelper.STATE_CLOSE:
            targetView.scrollTo(0, 0);
            onBindSlideClose(SlideAnimationHelper.STATE_CLOSE);
            break;
        case SlideAnimationHelper.STATE_OPEN:
            targetView.scrollTo(-mOffset, 0);
            doAnimationSetOpen(SlideAnimationHelper.STATE_OPEN);
            break;
    }
}
 
Example 7
Project: LuaViewPlayground   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 8
Project: LuaViewPlayground   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
Example 9
Project: airgram   File: View10.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 10
Project: airgram   File: View10.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
Example 11
Project: CSipSimple   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 12
Project: CSipSimple   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollY(), value);
    }
}
 
Example 13
Project: exciting-app   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 14
Project: exciting-app   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
Example 15
Project: PlusGram   File: View10.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 16
Project: PlusGram   File: View10.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
Example 17
Project: boohee_v5.6   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = (View) this.mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 18
Project: boohee_v5.6   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = (View) this.mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
Example 19
Project: android-project-gallery   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
Example 20
Project: android-project-gallery   File: AnimatorProxy.java   Source Code and License Vote up 5 votes
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}