Available Methods
- findViewById ( )
- getId ( )
- getLayoutParams ( )
- getTag ( )
- setTag ( )
- VISIBLE
- setVisibility ( )
- setOnClickListener ( )
- OnClickListener ( )
- getLeft ( )
- getHeight ( )
- getWidth ( )
- getTop ( )
- getVisibility ( )
- GONE
- setLayoutParams ( )
- getMeasuredHeight ( )
- inflate ( )
- getBottom ( )
- getMeasuredWidth ( )
- setBackgroundColor ( )
- getRight ( )
- measure ( )
- getParent ( )
- layout ( )
- getContext ( )
- setAlpha ( )
- setTranslationX ( )
- startAnimation ( )
- setScaleX ( )
- setScaleY ( )
- setPadding ( )
- setBackgroundResource ( )
- requestFocus ( )
- getLocationOnScreen ( )
- setTranslationY ( )
- setDrawingCacheEnabled ( )
- setPivotY ( )
- setOnLongClickListener ( )
- setPivotX ( )
- setBackground ( )
- INVISIBLE
- draw ( )
- setSystemUiVisibility ( )
- setBackgroundDrawable ( )
- equals ( )
- NO_ID
- getScrollY ( )
- OnLongClickListener ( )
- getBackground ( )
- postDelayed ( )
- setEnabled ( )
- setSelected ( )
- getY ( )
- requestLayout ( )
- getScrollX ( )
- setClickable ( )
- post ( )
- getDrawingCache ( )
- getTranslationY ( )
- setOnTouchListener ( )
- SYSTEM_UI_FLAG_FULLSCREEN
- destroyDrawingCache ( )
- SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- OnTouchListener ( )
- setRotation ( )
- getHitRect ( )
- getPaddingRight ( )
- setRotationY ( )
- invalidate ( )
- getPaddingBottom ( )
- buildDrawingCache ( )
- SYSTEM_UI_FLAG_HIDE_NAVIGATION
- LAYOUT_DIRECTION_RTL
- setId ( )
- setPressed ( )
- getLocationInWindow ( )
- clearAnimation ( )
- SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- SYSTEM_UI_FLAG_LAYOUT_STABLE
- getPaddingLeft ( )
- getX ( )
- getTranslationX ( )
- getDrawingRect ( )
- FOCUS_UP
- getPaddingTop ( )
- SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- setLayerType ( )
- getGlobalVisibleRect ( )
- setFocusable ( )
- setRotationX ( )
- FOCUS_RIGHT
- clearFocus ( )
- getViewTreeObserver ( )
- SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
- canScrollVertically ( )
- getRootView ( )
- dispatchPopulateAccessibilityEvent ( )
- postOnAnimation ( )
- isShown ( )
- setY ( )
- FOCUS_LEFT
- getSystemUiVisibility ( )
- offsetLeftAndRight ( )
- getWindowVisibleDisplayFrame ( )
- getResources ( )
- getScaleX ( )
- addTouchables ( )
- bringToFront ( )
- isEnabled ( )
- performClick ( )
- FOCUS_DOWN
- FOCUS_BACKWARD
- setX ( )
- setFitsSystemWindows ( )
- FOCUS_FORWARD
- SYSTEM_UI_FLAG_LOW_PROFILE
- getWindowToken ( )
- setAnimation ( )
- offsetTopAndBottom ( )
- setFocusableInTouchMode ( )
- generateViewId ( )
- isSelected ( )
- sendAccessibilityEvent ( )
- setOnCreateContextMenuListener ( )
- removeCallbacks ( )
- scrollTo ( )
- setMinimumWidth ( )
- isClickable ( )
- getLayerType ( )
- getAlpha ( )
- setOnSystemUiVisibilityChangeListener ( )
- addFocusables ( )
- isFocusable ( )
- getClass ( )
- setDrawingCacheBackgroundColor ( )
- dispatchTouchEvent ( )
- setActivated ( )
- SYSTEM_UI_FLAG_IMMERSIVE
- LAYER_TYPE_HARDWARE
- hashCode ( )
- setElevation ( )
- addOnLayoutChangeListener ( )
- setAccessibilityDelegate ( )
- OnFocusChangeListener ( )
- LAYER_TYPE_NONE
- isLayoutRequested ( )
- setCameraDistance ( )
- isPressed ( )
- getAnimation ( )
- getScaleY ( )
- getRotationY ( )
- setMinimumHeight ( )
- animate ( )
- getOverScrollMode ( )
- getRotationX ( )
- onTouchEvent ( )
- setContentDescription ( )
- getRotation ( )
- SYSTEM_UI_FLAG_VISIBLE
- setLongClickable ( )
- canScrollHorizontally ( )
- performHapticFeedback ( )
- hasFocus ( )
- removeOnAttachStateChangeListener ( )
- cancelLongPress ( )
- LAYOUT_DIRECTION_LTR
- OVER_SCROLL_NEVER
- isInEditMode ( )
- getLayoutDirection ( )
- playSoundEffect ( )
- getDrawingCacheBackgroundColor ( )
- setOutlineProvider ( )
- getDefaultSize ( )
- isAttachedToWindow ( )
- SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
- setOnKeyListener ( )
- setWillNotCacheDrawing ( )
- hasTransientState ( )
- getLocalVisibleRect ( )
- startDrag ( )
- getPivotY ( )
- willNotCacheDrawing ( )
- LAYER_TYPE_SOFTWARE
- saveHierarchyState ( )
- findViewWithTag ( )
- performLongClick ( )
- requestFocusFromTouch ( )
- setOnApplyWindowInsetsListener ( )
- postInvalidateOnAnimation ( )
- isLongClickable ( )
- setTranslationZ ( )
- setOnFocusChangeListener ( )
- hasFocusable ( )
- setTop ( )
- addOnAttachStateChangeListener ( )
- postInvalidate ( )
- postInvalidateDelayed ( )
- onStartTemporaryDetach ( )
- removeOnLayoutChangeListener ( )
- getAccessibilityViewId ( )
- restoreHierarchyState ( )
- isHardwareAccelerated ( )
- setHasTransientState ( )
- getImportantForAccessibility ( )
- setBottom ( )
- setLeft ( )
- DragShadowBuilder ( )
- getBaseline ( )
- SCROLL_AXIS_VERTICAL
- setScrollX ( )
- isFocusableInTouchMode ( )
- forceLayout ( )
- setPaddingRelative ( )
- SCROLLBAR_POSITION_RIGHT
- setImportantForAccessibility ( )
- getPivotX ( )
- getContentDescription ( )
- announceForAccessibility ( )
- isDrawingCacheEnabled ( )
- showContextMenu ( )
- setDrawingCacheQuality ( )
- setRight ( )
- OnKeyListener ( )
- getFitsSystemWindows ( )
- OnLayoutChangeListener ( )
- getTransitionName ( )
- addView ( )
- dispatchApplyWindowInsets ( )
- onCheckIsTextEditor ( )
- setLayoutDirection ( )
- onFinishTemporaryDetach ( )
- setTransitionName ( )
- isFocused ( )
- getRootWindowInsets ( )
- jumpDrawablesToCurrentState ( )
- setClipToOutline ( )
- getWindowVisibility ( )
- getFocusedRect ( )
- IMPORTANT_FOR_ACCESSIBILITY_AUTO
- setScrollY ( )
- isActivated ( )
- STATUS_BAR_HIDDEN
- setOverScrollMode ( )
- setLabelFor ( )
- getMatrix ( )
- setHorizontalScrollBarEnabled ( )
- isOpaque ( )
- getParentForAccessibility ( )
- setLayerPaint ( )
- startDragAndDrop ( )
- setStateListAnimator ( )
- postOnAnimationDelayed ( )
- getPaddingStart ( )
- hasWindowFocus ( )
- getMinimumHeight ( )
- resolveSize ( )
- findFocus ( )
- AUTOFILL_TYPE_DATE
- setKeepScreenOn ( )
- focusSearch ( )
- getPaddingEnd ( )
- onInitializeAccessibilityNodeInfo ( )
- getViewRootImpl ( )
- isInTouchMode ( )
- getKeyDispatcherState ( )
- isLaidOut ( )
- scrollBy ( )
- AUTOFILL_TYPE_TEXT
- getTranslationZ ( )
- getWindowSystemUiVisibility ( )
- OVER_SCROLL_ALWAYS
- getMeasuredWidthAndState ( )
- performAccessibilityAction ( )
- AccessibilityDelegate ( )
- STATUS_BAR_TRANSLUCENT
- callOnClick ( )
- getAccessibilityLiveRegion ( )
- resolveSizeAndState ( )
- isImportantForAccessibility ( )
- getLabelFor ( )
- OnAttachStateChangeListener ( )
- getMeasuredHeightAndState ( )
- TEXT_ALIGNMENT_GRAVITY
- drawableHotspotChanged ( )
- getAccessibilityNodeProvider ( )
- onInitializeAccessibilityEvent ( )
- getZ ( )
- refreshDrawableState ( )
- IMPORTANT_FOR_ACCESSIBILITY_YES
- AUTOFILL_HINT_USERNAME
- setTagInternal ( )
- getHandler ( )
- getOnFocusChangeListener ( )
- isScrollContainer ( )
- getNextFocusRightId ( )
- IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
- getWindowId ( )
- TEXT_ALIGNMENT_VIEW_START
- onPopulateAccessibilityEvent ( )
- TRANSLATION_Y
- setWillNotDraw ( )
- setTextAlignment ( )
Related Classes
- java.io.File
- android.os.Bundle
- android.content.Context
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.widget.Button
- android.graphics.Bitmap
- android.text.TextUtils
- android.view.MotionEvent
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
- android.support.annotation.Nullable
- android.widget.EditText
- android.content.SharedPreferences
- android.support.annotation.NonNull
Java Code Examples for android.view.View#OVER_SCROLL_ALWAYS
The following examples show how to use
android.view.View#OVER_SCROLL_ALWAYS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactScrollViewHelper.java From react-native-GPay with MIT License | 5 votes |
public static int parseOverScrollMode(String jsOverScrollMode) { if (jsOverScrollMode == null || jsOverScrollMode.equals(AUTO)) { return View.OVER_SCROLL_IF_CONTENT_SCROLLS; } else if (jsOverScrollMode.equals(OVER_SCROLL_ALWAYS)) { return View.OVER_SCROLL_ALWAYS; } else if (jsOverScrollMode.equals(OVER_SCROLL_NEVER)) { return View.OVER_SCROLL_NEVER; } else { throw new JSApplicationIllegalArgumentException("wrong overScrollMode: " + jsOverScrollMode); } }
Example 2
Source File: NestedScrollView.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
@Override public void computeScroll() { if (mScroller.computeScrollOffset()) { int oldX = getScrollX(); int oldY = getScrollY(); int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); if (oldX != x || oldY != y) { final int range = getScrollRange(); final int overscrollMode = getOverScrollMode(); final boolean canOverscroll = overscrollMode == View.OVER_SCROLL_ALWAYS || (overscrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0); overScrollByCompat(x - oldX, y - oldY, oldX, oldY, 0, range, 0, 0, false); if (canOverscroll) { ensureGlows(); if (y <= 0 && oldY > 0) { mEdgeGlowTop.onAbsorb((int) mScroller.getCurrVelocity()); } else if (y >= range && oldY < range ) { mEdgeGlowBottom.onAbsorb((int) mScroller.getCurrVelocity()); } } } else if (!isFling){ //回弹过程中有可能会相同,也需要刷新 //Log.i("you", "postInvalidate..."); postInvalidate(); } } }
Example 3
Source File: OverScrollGlow.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Pull leftover touch scroll distance into one of the edge glows as appropriate. * * @param x Current X scroll offset * @param y Current Y scroll offset * @param oldX Old X scroll offset * @param oldY Old Y scroll offset * @param maxX Maximum range for horizontal scrolling * @param maxY Maximum range for vertical scrolling */ public void pullGlow(int x, int y, int oldX, int oldY, int maxX, int maxY) { // Only show overscroll bars if there was no movement in any direction // as a result of scrolling. if (oldX == mHostView.getScrollX() && oldY == mHostView.getScrollY()) { // Don't show left/right glows if we fit the whole content. // Also don't show if there was vertical movement. if (maxX > 0) { final int pulledToX = oldX + mOverScrollDeltaX; if (pulledToX < 0) { mEdgeGlowLeft.onPull((float) mOverScrollDeltaX / mHostView.getWidth()); if (!mEdgeGlowRight.isFinished()) { mEdgeGlowRight.onRelease(); } } else if (pulledToX > maxX) { mEdgeGlowRight.onPull((float) mOverScrollDeltaX / mHostView.getWidth()); if (!mEdgeGlowLeft.isFinished()) { mEdgeGlowLeft.onRelease(); } } mOverScrollDeltaX = 0; } if (maxY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) { final int pulledToY = oldY + mOverScrollDeltaY; if (pulledToY < 0) { mEdgeGlowTop.onPull((float) mOverScrollDeltaY / mHostView.getHeight()); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } } else if (pulledToY > maxY) { mEdgeGlowBottom.onPull((float) mOverScrollDeltaY / mHostView.getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } } mOverScrollDeltaY = 0; } } }
Example 4
Source File: OverScrollGlow.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Absorb leftover fling velocity into one of the edge glows as appropriate. * * @param x Current X scroll offset * @param y Current Y scroll offset * @param oldX Old X scroll offset * @param oldY Old Y scroll offset * @param rangeX Maximum range for horizontal scrolling * @param rangeY Maximum range for vertical scrolling * @param currentFlingVelocity Current fling velocity */ public void absorbGlow(int x, int y, int oldX, int oldY, int rangeX, int rangeY, float currentFlingVelocity) { if (rangeY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) { if (y < 0 && oldY >= 0) { mEdgeGlowTop.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } } else if (y > rangeY && oldY <= rangeY) { mEdgeGlowBottom.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } } } if (rangeX > 0) { if (x < 0 && oldX >= 0) { mEdgeGlowLeft.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowRight.isFinished()) { mEdgeGlowRight.onRelease(); } } else if (x > rangeX && oldX <= rangeX) { mEdgeGlowRight.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowLeft.isFinished()) { mEdgeGlowLeft.onRelease(); } } } }
Example 5
Source File: OverScrollGlow.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Pull leftover touch scroll distance into one of the edge glows as appropriate. * * @param x Current X scroll offset * @param y Current Y scroll offset * @param oldX Old X scroll offset * @param oldY Old Y scroll offset * @param maxX Maximum range for horizontal scrolling * @param maxY Maximum range for vertical scrolling */ public void pullGlow(int x, int y, int oldX, int oldY, int maxX, int maxY) { // Only show overscroll bars if there was no movement in any direction // as a result of scrolling. if (oldX == mHostView.getScrollX() && oldY == mHostView.getScrollY()) { // Don't show left/right glows if we fit the whole content. // Also don't show if there was vertical movement. if (maxX > 0) { final int pulledToX = oldX + mOverScrollDeltaX; if (pulledToX < 0) { mEdgeGlowLeft.onPull((float) mOverScrollDeltaX / mHostView.getWidth()); if (!mEdgeGlowRight.isFinished()) { mEdgeGlowRight.onRelease(); } } else if (pulledToX > maxX) { mEdgeGlowRight.onPull((float) mOverScrollDeltaX / mHostView.getWidth()); if (!mEdgeGlowLeft.isFinished()) { mEdgeGlowLeft.onRelease(); } } mOverScrollDeltaX = 0; } if (maxY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) { final int pulledToY = oldY + mOverScrollDeltaY; if (pulledToY < 0) { mEdgeGlowTop.onPull((float) mOverScrollDeltaY / mHostView.getHeight()); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } } else if (pulledToY > maxY) { mEdgeGlowBottom.onPull((float) mOverScrollDeltaY / mHostView.getHeight()); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } } mOverScrollDeltaY = 0; } } }
Example 6
Source File: OverScrollGlow.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Absorb leftover fling velocity into one of the edge glows as appropriate. * * @param x Current X scroll offset * @param y Current Y scroll offset * @param oldX Old X scroll offset * @param oldY Old Y scroll offset * @param rangeX Maximum range for horizontal scrolling * @param rangeY Maximum range for vertical scrolling * @param currentFlingVelocity Current fling velocity */ public void absorbGlow(int x, int y, int oldX, int oldY, int rangeX, int rangeY, float currentFlingVelocity) { if (rangeY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) { if (y < 0 && oldY >= 0) { mEdgeGlowTop.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowBottom.isFinished()) { mEdgeGlowBottom.onRelease(); } } else if (y > rangeY && oldY <= rangeY) { mEdgeGlowBottom.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowTop.isFinished()) { mEdgeGlowTop.onRelease(); } } } if (rangeX > 0) { if (x < 0 && oldX >= 0) { mEdgeGlowLeft.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowRight.isFinished()) { mEdgeGlowRight.onRelease(); } } else if (x > rangeX && oldX <= rangeX) { mEdgeGlowRight.onAbsorb((int) currentFlingVelocity); if (!mEdgeGlowLeft.isFinished()) { mEdgeGlowLeft.onRelease(); } } } }
Example 7
Source File: NestedScrollView.java From AndroidAnimationExercise with Apache License 2.0 | 4 votes |
/** * 滑动功能核心代码 * @param deltaX * @param deltaY * @param scrollX * @param scrollY * @param scrollRangeX * @param scrollRangeY * @param maxOverScrollX * @param maxOverScrollY * @param isTouchEvent * @return */ boolean overScrollByCompat(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { final int overScrollMode = getOverScrollMode(); final boolean canScrollHorizontal = computeHorizontalScrollRange() > computeHorizontalScrollExtent(); final boolean canScrollVertical = computeVerticalScrollRange() > computeVerticalScrollExtent(); final boolean overScrollHorizontal = overScrollMode == View.OVER_SCROLL_ALWAYS || (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal); final boolean overScrollVertical = overScrollMode == View.OVER_SCROLL_ALWAYS || (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical); int newScrollX = scrollX + deltaX; if (!overScrollHorizontal) { maxOverScrollX = 0; } //此处修改原码 if (scrollY < 0 && deltaY < 0) {//偏移往下滑动 deltaY /= PULLDOWN_SCROLL; } int newScrollY = scrollY + deltaY; if (!overScrollVertical) { maxOverScrollY = 0; } // Clamp values if at the limits and record final int left = -maxOverScrollX; final int right = maxOverScrollX + scrollRangeX; //此处修改原码 int top; if (isFling) { top = - maxOverScrollY; } else { top = -getPulldownScroll(); } final int bottom = maxOverScrollY + scrollRangeY; boolean clampedX = false; if (newScrollX > right) { newScrollX = right; clampedX = true; } else if (newScrollX < left) { newScrollX = left; clampedX = true; } boolean clampedY = false; if (newScrollY > bottom) {//滑动越出界限 newScrollY = bottom; clampedY = true; } else if (newScrollY < top) { newScrollY = top; clampedY = true; } if (clampedY && isFling) {//这里isFling时才回弹 //Log.i("you", top + " " + bottom + " "+deltaY+" "+newScrollY+" "+getScrollRange()); mScroller.springBack(newScrollX, newScrollY, 0, 0, 0, getScrollRange()); } onOverScrolled(newScrollX, newScrollY, clampedX, clampedY); return clampedX || clampedY; }