當前位置: 首頁>>代碼示例>>Java>>正文


Java Scroller類代碼示例

本文整理匯總了Java中android.widget.Scroller的典型用法代碼示例。如果您正苦於以下問題:Java Scroller類的具體用法?Java Scroller怎麽用?Java Scroller使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Scroller類屬於android.widget包,在下文中一共展示了Scroller類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BaseReadView

import android.widget.Scroller; //導入依賴的package包/類
public BaseReadView(Context context, String bookId, List<BookMixAToc.mixToc.Chapters> chaptersList,
                    OnReadStateChangeListener listener) {
    super(context);
    this.listener = listener;
    this.bookId = bookId;

    mScreenWidth = ScreenUtils.getScreenWidth();
    mScreenHeight = ScreenUtils.getScreenHeight();

    mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.ARGB_8888);
    mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.ARGB_8888);
    mCurrentPageCanvas = new Canvas(mCurPageBitmap);
    mNextPageCanvas = new Canvas(mNextPageBitmap);

    mScroller = new Scroller(getContext());

    pagefactory = new PageFactory(getContext(), bookId, chaptersList);
    pagefactory.setOnReadStateChangeListener(listener);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:BaseReadView.java

示例2: prepare

import android.widget.Scroller; //導入依賴的package包/類
private void prepare(AttributeSet attrs)
{
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    mScroller = new Scroller(getContext());
    mScaleGestureDetector = new ScaleGestureDetector(getContext(), mScaleListener);
    mGestureDetector = new GestureDetectorCompat(getContext(), mGestureListener);
    if (attrs != null)
    {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CustomViewExtension, 0, 0);
        autoScrollMargins = a.getDimensionPixelSize(R.styleable.CustomViewExtension_autoScrollMargins, 0);
        a.recycle();
    }
    mEdgeGlowLeft = new EdgeEffectCompat(getContext());
    mEdgeGlowTop = new EdgeEffectCompat(getContext());
    mEdgeGlowRight = new EdgeEffectCompat(getContext());
    mEdgeGlowBottom = new EdgeEffectCompat(getContext());
    setWillNotDraw(false);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:21,代碼來源:TwoDScrollView.java

示例3: setScrollerInterpolatorOrReCreateScroller

import android.widget.Scroller; //導入依賴的package包/類
public static Scroller setScrollerInterpolatorOrReCreateScroller(Context context,
                                                                 Scroller scroller,
                                                                 Interpolator interpolator) {
    try {
        if (sScrollerInterpolatorField == null) {
            sScrollerInterpolatorField = Scroller.class.getDeclaredField("mInterpolator");
            if (sScrollerInterpolatorField != null)
                sScrollerInterpolatorField.setAccessible(true);
        }
        if (sScrollerInterpolatorField == null) {
            return new Scroller(context, interpolator);
        } else {
            sScrollerInterpolatorField.set(scroller, interpolator);
            return scroller;
        }
    } catch (Exception e) {
        return new Scroller(context, interpolator);
    }
}
 
開發者ID:dkzwm,項目名稱:SmoothRefreshLayout,代碼行數:20,代碼來源:SRReflectUtil.java

示例4: init

import android.widget.Scroller; //導入依賴的package包/類
private void init() {
        configuration = ViewConfiguration.get(getContext());
        mScroller = new Scroller(getContext(), new OvershootInterpolator(0.75f));
        flingRunnable = new FlingRunnable();
        overScrollRunnable = new OverScrollRunnable();
        flingScroller = new OverScroller(getContext());
        detector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
            @Override
            public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                if (isOverScrollTop || isOverScrollBottom || isOverScrollLeft || isOverScrollRight) {
                    return false;
                }
//
                flingRunnable.start(velocityX, velocityY);
                return false;
            }
        });
    }
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:19,代碼來源:OverScrollLayout.java

示例5: initView

import android.widget.Scroller; //導入依賴的package包/類
private synchronized void initView() {
	mLeftViewIndex = -1;
	mRightViewIndex = 0;
	mDisplayOffset = 0;
	mCurrentX = 0;
	mNextX = 0;
	mMaxX = Integer.MAX_VALUE;
	mScroller = new Scroller(getContext());

	mGesture = new GestureDetector(getContext(), mOnGesture);
	DisplayMetrics displayMetrics = new DisplayMetrics();
	((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
	screenWidth = displayMetrics.widthPixels-180;

	verticalMinDistance = screenWidth/4;
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:17,代碼來源:HorizontialListView.java

示例6: initView

import android.widget.Scroller; //導入依賴的package包/類
private synchronized void initView() {
    this.mLeftViewIndex = -1;
    this.mRightViewIndex = 0;
    this.mDisplayOffset = 0;
    this.mCurrentX = 0;
    this.mNextX = 0;
    this.mFirstPosition = 0;
    this.mSpecificPosition = 0;
    this.mSpecificLeft = 0;
    this.mMaxX = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
    this.mMinX = Integer.MIN_VALUE;
    this.mScroller = new Scroller(getContext());
    if (!isInEditMode()) {
        this.mGesture = new GestureDetector(getContext(), this.mOnGesture);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:HorizontalListViewPosition.java

示例7: initWithContext

import android.widget.Scroller; //導入依賴的package包/類
private void initWithContext(Context context) {
	setFadingEdgeLength(0); // 消除邊界模糊
	setOverScrollMode(View.OVER_SCROLL_NEVER); // 消除滾動邊框

	mScroller = new Scroller(context, new DecelerateInterpolator());
	// XListView need the scroll event, and it will dispatch the event to
	// user's listener (as a proxy).
	super.setOnScrollListener(this);

	// init header view
	mHeaderView = new XListViewHeader(context);
	mHeaderViewContent = (RelativeLayout) mHeaderView
			.findViewById(R.id.xlistview_header_content);
	mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
	addHeaderView(mHeaderView);

	// init footer view
	mFooterView = new XListViewFooter(context);

	// init header height
	mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(
			new OnGlobalLayoutListener() {
				@SuppressWarnings("deprecation")
				@Override
				public void onGlobalLayout() {
					mHeaderViewHeight = mHeaderViewContent.getHeight();
					getViewTreeObserver()
					.removeGlobalOnLayoutListener(this);
				}
			});
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:XListView.java

示例8: DocumentView

import android.widget.Scroller; //導入依賴的package包/類
public DocumentView(Context context, final ZoomModel zoomModel, DecodingProgressModel progressModel, CurrentPageModel currentPageModel) {
    super(context);
    this.zoomModel = zoomModel;
    this.progressModel = progressModel;
    this.currentPageModel = currentPageModel;
    setKeepScreenOn(true);
    scroller = new Scroller(getContext());
    setFocusable(true);
    setFocusableInTouchMode(true);
    initMultiTouchZoomIfAvailable(zoomModel);
}
 
開發者ID:lidong1665,項目名稱:AndroidPDF,代碼行數:12,代碼來源:DocumentView.java

示例9: onScrollerFinished

import android.widget.Scroller; //導入依賴的package包/類
/**
 * Callback invoked upon completion of a given <code>scroller</code>.
 */
private void onScrollerFinished(Scroller scroller) {
    if (scroller == mFlingScroller) {
        if (!ensureScrollWheelAdjusted()) {
            updateInputTextView();
        }
        onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
    } else {
        if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
            updateInputTextView();
        }
    }
}
 
開發者ID:Gericop,項目名稱:DateTimePicker,代碼行數:16,代碼來源:NumberPicker.java

示例10: CompatScroller

import android.widget.Scroller; //導入依賴的package包/類
public CompatScroller(Context context) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
        isPreGingerbread = true;
        scroller = new Scroller(context);

    }
    else {
        isPreGingerbread = false;
        overScroller = new OverScroller(context);
    }
}
 
開發者ID:sega4revenge,項目名稱:Sega,代碼行數:12,代碼來源:TouchImageView.java

示例11: CompatScroller

import android.widget.Scroller; //導入依賴的package包/類
public CompatScroller(Context context) {
    if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
        isPreGingerbread = true;
        scroller = new Scroller(context);

    } else {
        isPreGingerbread = false;
        overScroller = new OverScroller(context);
    }
}
 
開發者ID:pedromassango,項目名稱:Programmers,代碼行數:11,代碼來源:TouchImageView.java

示例12: HLayoutContainer

import android.widget.Scroller; //導入依賴的package包/類
public HLayoutContainer(Context context, AttributeSet attrs) {
    super(context, attrs);
    // 獲取屏幕寬度
    DisplayMetrics metric = new DisplayMetrics();
    Display display = ((Activity) context).getWindowManager().getDefaultDisplay();
    display.getMetrics(metric);
    screenWidth = metric.widthPixels; // 屏幕寬度(像素)
    padding = 36;
    rightOffset = 60;
    offset = 10;
    mScroller = new Scroller(context);
    // 由於動畫會導致view出現覆蓋,所以我們要打開order開關來主動改變view的繪製順序
    setChildrenDrawingOrderEnabled(true);
}
 
開發者ID:wanbanjiesan,項目名稱:Android-TV-FocusLayout,代碼行數:15,代碼來源:HLayoutContainer.java

示例13: initCustomViewAbove

import android.widget.Scroller; //導入依賴的package包/類
void initCustomViewAbove() {
	setWillNotDraw(false);
	setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
	setFocusable(true);
	final Context context = getContext();
	mScroller = new Scroller(context, sInterpolator);
	final ViewConfiguration configuration = ViewConfiguration.get(context);
	mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
	setInternalPageChangeListener(new SimpleOnPageChangeListener() {
		public void onPageSelected(int position) {
			if (mViewBehind != null) {
				switch (position) {
				case 0:
				case 2:
					mViewBehind.setChildrenEnabled(true);
					break;
				case 1:
					mViewBehind.setChildrenEnabled(false);
					break;
				}
			}
		}
	});

	final float density = context.getResources().getDisplayMetrics().density;
	mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:30,代碼來源:CustomViewAbove.java

示例14: initViewPager

import android.widget.Scroller; //導入依賴的package包/類
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:28,代碼來源:ViewPagerCompat.java

示例15: onFinishInflate

import android.widget.Scroller; //導入依賴的package包/類
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mRootLayout = new HorizontalScrollView(getContext());
    mRootLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
    mParentLayout = new LinearLayout(getContext());
    mParentLayout.setOrientation(LinearLayout.HORIZONTAL);
    mScroller = new Scroller(mRootLayout.getContext(), new DecelerateInterpolator(1.2f));
    mParentLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    mRootLayout.addView(mParentLayout);
    addView(mRootLayout);
}
 
開發者ID:jakebonk,項目名稱:BoardView,代碼行數:13,代碼來源:BoardView.java


注:本文中的android.widget.Scroller類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。