public class ScrollableLayout
extends android.widget.FrameLayout
This is the main ViewGroup
for implementing Scrollable.
It has the same as FrameLayout.onMeasure(int, int)
measure logic,
but has it's own onLayout(boolean, int, int, int, int)
logic.
Note, that this ViewGroup will layout it's children as if it were an ordinary LinearLayout
with orientation set to LinearLayout.VERTICAL
.
No paddings or margins will affect the layout position of children,
although margins will certainly affect measurements.
The best usage would be to include two View
views.
The first one would represent the header
logic and the second would be scrollable container.
Note, that we should make use of ViewGroup.LayoutParams.MATCH_PARENT
as the height attribute for scrollable container. Because it directly affects the scrollable behavior.
If you wish to create a sticky
effect for one of the views in header
ViewGroup,
you could specify layout_marginTop
attribute for your scrollable layout,
which represents the height of your sticky element.
The logic behind scenes is simple. We should be able to encapsulate scrollable logic in a way (in a tabs
case),
that saves us from adding header placeholders and footers (so that scrollY does
not change when different tab is selected) to every ScrollView
, AbsListView
etc.
So, instead of modifying scrolling behavior of each scrollable View, we are creating our own
ViewGroup that handles it for us.
Follow these steps to create your own Scrollable layout:
Simple case
<ru.noties.scrollable.ScrollableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:scrollable_maxScroll="@dimen/header_height"> <!-- (!) -->
<View
android:layout_width="match_parent"
android:layout_height="@dimen/header_height" /> <!-- (!) -- >
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ru.noties.scrollable.ScrollableLayout>
Sticky case
(of cause it's just an xml step, you also should implement translation logic in OnScrollChangeListener
setOnScrollChangedListener(OnScrollChangedListener)
)
<ru.noties.scrollable.ScrollableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:scrollable_maxScroll="@dimen/header_height">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/header_height" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/sticky_height" /> <!-- (!) -->
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/sticky_height" /> <!-- (!) -->
Created by Dimitry Ivanov (mail@dimitryivanov.ru) on 28.03.2015.android.widget.FrameLayout.LayoutParams
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
Constructor and Description |
---|
ScrollableLayout(android.content.Context context) |
ScrollableLayout(android.content.Context context,
android.util.AttributeSet attrs) |
ScrollableLayout(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
Modifier and Type | Method and Description |
---|---|
void |
computeScroll() |
protected int |
computeVerticalScrollRange() |
boolean |
dispatchTouchEvent(android.view.MotionEvent event) |
long |
getConsiderIdleMillis() |
int |
getMaxScrollY() |
protected int |
getNewY(int y) |
protected android.widget.Scroller |
initScroller(android.content.Context context,
android.view.animation.Interpolator interpolator,
boolean flywheel)
Override this method if you wish to create own
Scroller |
protected boolean |
isSelfUpdateScroll() |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
void |
onRestoreInstanceState(android.os.Parcelable state) |
android.os.Parcelable |
onSaveInstanceState() |
void |
onScrollChanged(int l,
int t,
int oldL,
int oldT) |
void |
scrollTo(int x,
int y) |
void |
setCanScrollVerticallyDelegate(CanScrollVerticallyDelegate delegate) |
void |
setCloseAnimatorConfigurator(CloseUpAnimatorConfigurator configurator) |
void |
setCloseUpAlgorithm(CloseUpAlgorithm closeUpAlgorithm)
Note that
DefaultCloseUpAlgorithm might be set with
xml definition ( app:scrollable_defaultCloseUp="true" ) |
void |
setCloseUpIdleAnimationTime(CloseUpIdleAnimationTime closeUpIdleAnimationTime)
Note that
SimpleCloseUpIdleAnimationTime might be set with xml definition
( app:scrollable_closeUpAnimationMillis="200" ) |
void |
setConsiderIdleMillis(long millis)
Note that this value might be set with xml definition (
app:scrollable_considerIdleMillis="100" ) |
void |
setDraggableView(android.view.View view)
Sets View which should be included in receiving scroll gestures.
|
void |
setFriction(float friction)
Sets friction for current
Scroller |
void |
setMaxScrollY(int maxY)
Also can be set via xml attribute
scrollable_maxScroll |
void |
setOnScrollChangedListener(OnScrollChangedListener listener)
Pass an
OnScrollChangedListener
if you wish to get notifications when scroll state of this View has changed. |
protected void |
setSelfUpdateScroll(boolean value) |
checkLayoutParams, draw, drawableHotspotChanged, drawableStateChanged, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getConsiderGoneChildrenWhenMeasuring, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getMeasureAllChildren, jumpDrawablesToCurrentState, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onMeasure, onSizeChanged, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setMeasureAllChildren, setVisibility, shouldDelayChildPressedState, verifyDrawable
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onRtlPropertiesChanged, onScreenStateChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayout
public ScrollableLayout(android.content.Context context)
public ScrollableLayout(android.content.Context context, android.util.AttributeSet attrs)
public ScrollableLayout(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
protected android.widget.Scroller initScroller(android.content.Context context, android.view.animation.Interpolator interpolator, boolean flywheel)
Scroller
context
- Context
interpolator
- Interpolator
, the default implementation passes null
flywheel
- Scroller.Scroller(android.content.Context, android.view.animation.Interpolator, boolean)
Scroller
must not bu nullpublic void setFriction(float friction)
Scroller
friction
- to be appliedScroller.setFriction(float)
public void setCanScrollVerticallyDelegate(CanScrollVerticallyDelegate delegate)
delegate
- which will be invoked when scroll state of scrollable children is neededCanScrollVerticallyDelegate
public void setMaxScrollY(int maxY)
scrollable_maxScroll
maxY
- the max scroll y available for this View.getMaxScrollY()
public int getMaxScrollY()
this
View (aka header
height)setMaxScrollY(int)
public void setConsiderIdleMillis(long millis)
app:scrollable_considerIdleMillis="100"
)millis
- millis after which current scroll
state would be considered idle and thus firing close up logic if setgetConsiderIdleMillis()
,
DEFAULT_CONSIDER_IDLE_MILLIS
public long getConsiderIdleMillis()
setConsiderIdleMillis(long)
public void setOnScrollChangedListener(OnScrollChangedListener listener)
OnScrollChangedListener
if you wish to get notifications when scroll state of this
View has changed.
It\'s helpful for implementing own logic which depends on scroll state (e.g. parallax, alpha, etc)listener
- to be invoked when onScrollChanged(int, int, int, int)
has been called.
Might be null
if you don\'t want to receive scroll notifications anymorepublic void onScrollChanged(int l, int t, int oldL, int oldT)
onScrollChanged
in class android.view.View
View.onScrollChanged(int, int, int, int)
,
OnScrollChangedListener.onScrollChanged(int, int, int)
,
CloseUpAlgorithm
protected void setSelfUpdateScroll(boolean value)
protected boolean isSelfUpdateScroll()
public void setCloseUpAlgorithm(CloseUpAlgorithm closeUpAlgorithm)
DefaultCloseUpAlgorithm
might be set with
xml definition ( app:scrollable_defaultCloseUp="true"
)closeUpAlgorithm
- CloseUpAlgorithm
implementation, might be nullCloseUpAlgorithm
,
DefaultCloseUpAlgorithm
public void setCloseUpIdleAnimationTime(CloseUpIdleAnimationTime closeUpIdleAnimationTime)
SimpleCloseUpIdleAnimationTime
might be set with xml definition
( app:scrollable_closeUpAnimationMillis="200"
)closeUpIdleAnimationTime
- CloseUpIdleAnimationTime
implementation, might be nullCloseUpIdleAnimationTime
,
SimpleCloseUpIdleAnimationTime
,
DEFAULT_IDLE_CLOSE_UP_ANIMATION
public void setCloseAnimatorConfigurator(CloseUpAnimatorConfigurator configurator)
configurator
- CloseUpAnimatorConfigurator
implementation
to process current close up
ObjectAnimator
, might be nullCloseUpAnimatorConfigurator
,
ObjectAnimator
public void scrollTo(int x, int y)
scrollTo
in class android.view.View
View.scrollTo(int, int)
,
setCanScrollVerticallyDelegate(CanScrollVerticallyDelegate)
,
setMaxScrollY(int)
protected int getNewY(int y)
public void setDraggableView(android.view.View view)
view
- you wish to include in scrolling gestures (aka tabs)public boolean dispatchTouchEvent(android.view.MotionEvent event)
dispatchTouchEvent
in class android.view.ViewGroup
public void computeScroll()
computeScroll
in class android.view.View
protected int computeVerticalScrollRange()
computeVerticalScrollRange
in class android.view.View
protected void onLayout(boolean changed, int left, int top, int right, int bottom)
onLayout
in class android.widget.FrameLayout
public android.os.Parcelable onSaveInstanceState()
onSaveInstanceState
in class android.view.View
public void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState
in class android.view.View