當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。