本文整理汇总了Java中android.view.View.scrollTo方法的典型用法代码示例。如果您正苦于以下问题:Java View.scrollTo方法的具体用法?Java View.scrollTo怎么用?Java View.scrollTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.scrollTo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeDrawer
import android.view.View; //导入方法依赖的package包/类
public void closeDrawer() {
View menuView = mLeftMenuView;
menuView.scrollTo(-menuView.getWidth(), menuView.getTop());
invalidate();
mLeftMenuOnScrren = 0.0f;
}
示例2: openDrawer
import android.view.View; //导入方法依赖的package包/类
public void openDrawer() {
View menuView = mLeftMenuView;
menuView.scrollTo(0, menuView.getTop());
mLeftMenuOnScrren = 1.0f;
invalidate();
isDrawerOpen = true;
}
示例3: scrollTo
import android.view.View; //导入方法依赖的package包/类
/**
* 滚动到某个位置
*
* @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;
}
示例4: handleMessage
import android.view.View; //导入方法依赖的package包/类
@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();
}
}
示例5: setState
import android.view.View; //导入方法依赖的package包/类
/**
* 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));
}
}
示例6: onBindSlide
import android.view.View; //导入方法依赖的package包/类
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;
}
}
示例7: setScrollX
import android.view.View; //导入方法依赖的package包/类
public void setScrollX(int value) {
View view = mView.get();
if (view != null) {
view.scrollTo(value, view.getScrollY());
}
}
示例8: setScrollY
import android.view.View; //导入方法依赖的package包/类
public void setScrollY(int value) {
View view = mView.get();
if (view != null) {
view.scrollTo(view.getScrollX(), value);
}
}
示例9: setScrollY
import android.view.View; //导入方法依赖的package包/类
public void setScrollY(int value) {
View view = mView.get();
if (view != null) {
view.scrollTo(view.getScrollY(), value);
}
}
示例10: setScrollX
import android.view.View; //导入方法依赖的package包/类
public void setScrollX(int value) {
View view = (View) this.mView.get();
if (view != null) {
view.scrollTo(value, view.getScrollY());
}
}
示例11: setScrollY
import android.view.View; //导入方法依赖的package包/类
public void setScrollY(int value) {
View view = (View) this.mView.get();
if (view != null) {
view.scrollTo(view.getScrollX(), value);
}
}