当前位置: 首页>>代码示例>>Java>>正文


Java View.scrollTo方法代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:DrawerLayout.java

示例2: openDrawer

import android.view.View; //导入方法依赖的package包/类
public void openDrawer() {

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

        invalidate();
        isDrawerOpen = true;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DrawerLayout.java

示例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;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:15,代码来源:UDView.java

示例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();
	}
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:41,代码来源:SwipeListView.java

示例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));
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:45,代码来源:AnchorSheetBehavior.java

示例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;
    }
}
 
开发者ID:yangchong211,项目名称:YCSlideView,代码行数:13,代码来源:SlideViewHolder.java

示例7: setScrollX

import android.view.View; //导入方法依赖的package包/类
public void setScrollX(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(value, view.getScrollY());
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:7,代码来源:AnimatorProxy.java

示例8: setScrollY

import android.view.View; //导入方法依赖的package包/类
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollX(), value);
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:7,代码来源:AnimatorProxy.java

示例9: setScrollY

import android.view.View; //导入方法依赖的package包/类
public void setScrollY(int value) {
    View view = mView.get();
    if (view != null) {
        view.scrollTo(view.getScrollY(), value);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:7,代码来源:AnimatorProxy.java

示例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());
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:AnimatorProxy.java

示例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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:AnimatorProxy.java


注:本文中的android.view.View.scrollTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。