Class AbsListView
- All Implemented Interfaces:
Drawable.Callback
,ViewManager
,ViewParent
,Filter.FilterListener
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AbsListView extends LayoutParams to provide a place to hold the view type.static interface
A MultiChoiceModeListener receives events forCHOICE_MODE_MULTIPLE_MODAL
.static interface
Interface definition for a callback to be invoked when the list or grid has been scrolled.static interface
A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin's scrap heap.static interface
The top-level view of a list item can implement this interface to allow itself to modify the bounds of the selection shown for that item.Nested classes/interfaces inherited from class icyllis.modernui.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
Nested classes/interfaces inherited from class icyllis.modernui.view.ViewGroup
ViewGroup.MarginLayoutParams
Nested classes/interfaces inherited from class icyllis.modernui.view.View
View.DragShadow, View.Focusable, View.FocusableMode, View.FocusDirection, View.FocusRealDirection, View.LayoutDir, View.NestedScrollType, View.OnAttachStateChangeListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnTouchListener, View.ResolvedLayoutDir, View.ScrollAxis, View.ScrollBarStyle, View.ScrollIndicators, View.TextAlignment, View.Visibility
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The list allows multiple choicesstatic final int
The list allows multiple choices in a modal selection modestatic final int
Normal list that does not indicate choicesstatic final int
The list allows up to one choicestatic final int
The list will automatically scroll to the bottom, no matter what items are currently visible.static final int
Disables the transcript mode.static final int
The list will automatically scroll to the bottom when a data set change notification is received and only if the last item is already visible on screen.Fields inherited from class icyllis.modernui.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
Fields inherited from class icyllis.modernui.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_DISALLOW_INTERCEPT, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS
Fields inherited from class icyllis.modernui.view.View
ALPHA, BOTTOM, 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, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, 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, INVISIBLE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_UNDEFINED, LEFT, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mScrollX, mScrollY, NO_ID, NOT_FOCUSABLE, 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, RIGHT, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLL_X, SCROLL_Y, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, 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_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TOP, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, TYPE_NON_TOUCH, TYPE_TOUCH, VIEW_MARKER, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTouchables
(ArrayList<View> views) Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.boolean
canScrollList
(int direction) Check if the items in the list can be scrolled in a certain direction.protected boolean
Check whether given params fit to this view group.void
Clear any choices previously setprotected int
Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.protected int
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.protected int
Compute the vertical range that the vertical scrollbar represents.protected void
dispatchDraw
(Canvas canvas) Draw the child views.void
dispatchDrawableHotspotChanged
(float x, float y) Dispatches drawable hotspot changes to child views that meet at least one of the following criteria: Returnsfalse
from bothView.isClickable()
andView.isLongClickable()
Requests duplication of parent state viaView.setDuplicateParentStateEnabled(boolean)
protected void
dispatchSetPressed
(boolean pressed) Dispatch setPressed to all of this View's children.protected void
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.void
fling
(int velocityY) Initiate a fling with the given velocity.protected ViewGroup.LayoutParams
Returns a set of default layout parameters.protected ViewGroup.LayoutParams
Returns a safe set of layout parameters based on the supplied layout params.int
Returns the bottom edge effect color.int
Returns the number of items currently selected.long[]
Returns the set of checked items ids.int
Returns the currently checked item.Returns the set of checked items in the list.int
protected ContextMenu.ContextMenuInfo
Views should implement this if they have extra information to associate with the context menu.void
When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this method.int
List padding is the maximum of the normal view's padding and the padding of the selector.int
List padding is the maximum of the normal view's padding and the padding of the selector.int
List padding is the maximum of the normal view's padding and the padding of the selector.int
List padding is the maximum of the normal view's padding and the padding of the selector.Returns the selectorDrawable
that is used to draw the selection in the list.int
Returns the top edge effect color.int
Returns the current transcript mode.protected void
protected void
internalSetPadding
(int left, int top, int right, int bottom) void
Causes all the views to be rebuilt and redrawn.boolean
Returns whether the selection highlight drawable should be drawn on top of the item or behind it.boolean
isItemChecked
(int position) Returns the checked state of the specified position.boolean
Returns the current state of the fast scroll feature.boolean
Indicates whether the content of this view is pinned to, or stacked from, the bottom edge.protected void
Subclasses must override this method to layout their children.protected void
This is called when the view is attached to a window.void
Called as the result of a call toView.cancelPendingInputEvents()
on this view or a parent view.protected void
This is called when the view is detached from a window.void
onDrawForeground
(Canvas canvas) Draw any foreground content for this view.void
onFilterComplete
(int count) Notifies the end of a filtering operation.protected void
onFocusChanged
(boolean gainFocus, int direction, Rect previouslyFocusedRect) Called by the view system when the focus state of this view changes.boolean
onGenericMotionEvent
(MotionEvent event) Implement this method to handle generic motion events.boolean
Implement this method to intercept all touch screen motion events.boolean
Default implementation: perform press of the view whenKeyEvent.KEY_ENTER
,KeyEvent.KEY_KP_ENTER
orKeyEvent.KEY_SPACE
is released, if the view is enabled and clickable.boolean
Default implementation: perform clicking of the view whenKeyEvent.KEY_ENTER
,KeyEvent.KEY_KP_ENTER
orKeyEvent.KEY_SPACE
is released.protected void
onLayout
(boolean changed, int l, int t, int r, int b) Subclasses should NOT override this method butlayoutChildren()
instead.protected void
onMeasure
(int widthMeasureSpec, int heightMeasureSpec) Measure the view and its content to determine the measured width and the measured height.boolean
onNestedFling
(View target, float velocityX, float velocityY, boolean consumed) Request a fling from a nested scroll.void
onNestedScroll
(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, int[] consumed) React to a nested scroll in progress.void
onNestedScrollAccepted
(View child, View target, int axes, int type) React to the successful claiming of a nested scroll operation.protected void
onOverScrolled
(int scrollX, int scrollY, boolean clampedX, boolean clampedY) Called byView.overScrollBy(int, int, int, int, int, int, int, int, boolean)
to respond to the results of an over-scroll operation.protected void
onSizeChanged
(int w, int h, int oldw, int oldh) Called when width or height changedboolean
onStartNestedScroll
(View child, View target, int axes, int type) React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.boolean
Implement this method to handle touch screen motion events.void
onTouchModeChanged
(boolean isInTouchMode) void
onWindowFocusChanged
(boolean hasWindowFocus) Called when the window containing this view gains or loses focus.boolean
performItemClick
(View view, int position, long id) Call the OnItemClickListener, if it is defined.int
pointToPosition
(int x, int y) Maps a point to a position in the list.long
pointToRowId
(int x, int y) Maps a point to a the rowId of the item which intersects that point.void
reclaimViews
(List<View> views) Move all views (excluding headers and footers) held by this AbsListView into the supplied List.void
requestDisallowInterceptTouchEvent
(boolean disallowIntercept) Called when a child does not want this parent and its ancestors to intercept touch events withViewGroup.onInterceptTouchEvent(MotionEvent)
.void
Call this when something has changed which has invalidated the layout of this view.void
scrollListBy
(int y) Scrolls the list items within the view by a specified number of pixels.void
setAdapter
(ListAdapter adapter) Sets the adapter that provides the data and the views to represent the data in this widget.void
setBottomEdgeEffectColor
(int color) Sets the bottom edge effect color.void
setChoiceMode
(int choiceMode) Defines the choice behavior for the List.void
setDrawSelectorOnTop
(boolean onTop) Controls whether the selection highlight drawable should be drawn on top of the item or behind it.void
setEdgeEffectColor
(int color) Sets the edge effect color for both top and bottom edge effects.void
setFriction
(float friction) The amount of friction applied to flings.void
setItemChecked
(int position, boolean value) Sets the checked state of the specified position.void
Set aAbsListView.MultiChoiceModeListener
that will manage the lifecycle of the selectionActionMode
.void
Set the listener that will receive notifications every time the list scrolls.void
Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse.void
setScrollIndicators
(View up, View down) void
setSelectionFromTop
(int position, int y) Sets the selected item and positions the selection y pixels from the top edge of the ListView.void
setSelector
(Drawable sel) void
setSmoothScrollbarEnabled
(boolean enabled) When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items.void
setStackFromBottom
(boolean stackFromBottom) When stack from bottom is set to true, the list fills its content starting from the bottom of the view.void
setTopEdgeEffectColor
(int color) Sets the top edge effect color.void
setTranscriptMode
(int mode) Puts the list or grid into transcript mode.void
setVelocityScale
(float scale) Sets a scale factor for the fling velocity.final boolean
boolean
showContextMenu
(float x, float y) Shows the context menu for this view anchored to the specified view-relative coordinate.boolean
showContextMenuForChild
(View originalView, float x, float y) Shows the context menu for the specified view or its ancestors anchored to the specified view-relative coordinate.void
smoothScrollBy
(int distance, int duration) Smoothly scroll by distance pixels over duration milliseconds.void
smoothScrollToPosition
(int position) Smoothly scroll to the specified adapter position.void
smoothScrollToPosition
(int position, int boundPosition) Smoothly scroll to the specified adapter position.void
smoothScrollToPositionFromTop
(int position, int offset) Smoothly scroll to the specified adapter position.void
smoothScrollToPositionFromTop
(int position, int offset, int duration) Smoothly scroll to the specified adapter position.boolean
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.Methods inherited from class icyllis.modernui.widget.AdapterView
addView, addView, addView, addView, getAdapter, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener, setSelection
Methods inherited from class icyllis.modernui.view.ViewGroup
addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTransientView, addView, addViewInLayout, addViewInLayout, attachViewToParent, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFinishTemporaryDetach, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchTouchEvent, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewByPredicateTraversal, findViewTraversal, focusableViewAvailable, focusSearch, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildMeasureSpec, getChildVisibleRect, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutTransition, getNestedScrollAxes, getTouchscreenBlocksFocus, getTransientView, getTransientViewCount, getTransientViewIndex, hasBooleanFlag, hasFocus, hasTransientState, indexOfChild, isChildrenDrawingOrderEnabled, isLayoutSuppressed, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onChildVisibilityChanged, onCreateDrawableState, onInterceptHoverEvent, onNestedPreFling, onNestedPreScroll, onRequestFocusInDescendants, onResolvePointerIcon, onSetLayoutParams, onStopNestedScroll, onViewAdded, onViewRemoved, removeAllViewsInLayout, removeDetachedView, removeTransientView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestFocus, requestTransitionStart, resetResolvedDrawables, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, restoreDefaultFocus, setAddStatesFromChildren, setBooleanFlag, setChildrenDrawingOrderEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutTransition, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, startActionModeForChild, startViewTransition, suppressLayout, transformPointToViewLocal, updateViewLayout
Methods inherited from class icyllis.modernui.view.View
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, awakenScrollBars, awakenScrollBars, callOnClick, cancelLongPress, cancelPendingInputEvents, canReceivePointerEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerEvent, dp, draw, drawableHotspotChanged, findViewById, findViewByPredicate, findViewByPredicateInsideOut, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAlpha, getAnimationMatrix, getBackground, getBaseline, getBottom, getBoundsOnScreen, getBoundsOnScreen, getContext, getDefaultSize, getDrawableState, getDrawingRect, getElevation, getFadingEdge, getFadingEdgeLength, getFocusable, getFocusables, getForeground, getForegroundGravity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getInverseMatrix, getKeyDispatcherState, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOnLongClickListener, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getRevealOnFocusHint, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTextAlignment, getTextDirection, getTooltipText, getTooltipView, getTop, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewRoot, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowVisibility, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasIdentityMatrix, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasTranslationTransientState, hasWindowFocus, invalidate, invalidateDrawable, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForegroundInsidePadding, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInLayout, isInScrollingContainer, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionInherited, isLayoutDirectionResolved, isLayoutRequested, isLayoutRtl, isLongClickable, isNestedScrollingEnabled, isPaddingRelative, isPivotSet, isPressed, isRootNamespace, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentInherited, isTextAlignmentResolved, isTextDirectionInherited, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVerticalScrollBarHidden, keyboardNavigationClusterSearch, mapRectFromViewToScreenCoords, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCreateContextMenu, onDragEvent, onDraw, onDrawScrollBars, onFinishTemporaryDetach, onHoverChanged, onHoverEvent, onKeyShortcut, onResolveDrawables, onRtlPropertiesChanged, onScrollChanged, onStartTemporaryDetach, onVisibilityAggregated, onVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performButtonActionOnTouchDown, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, pointInView, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFocus, requestFocus, requestRectangleOnScreen, requestRectangleOnScreen, requireViewById, resetPivot, resolveSize, resolveSizeAndState, scheduleDrawable, scrollBy, scrollTo, setActivated, setAlpha, setAnimationMatrix, setBackground, setBottom, setClickable, setContextClickable, setDuplicateParentStateEnabled, setElevation, setEnabled, setFocusable, setFocusedByDefault, setFocusedInCluster, setForeground, setForegroundGravity, setFrame, setHapticFeedbackEnabled, setHasTransientState, setHasTranslationTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setIsRootNamespace, setKeyboardNavigationCluster, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setVisibility, setWillNotDraw, setX, setY, setZ, showContextMenu, sp, startActionMode, startActionMode, startDragAndDrop, startNestedScroll, stopNestedScroll, toGlobalMotionEvent, toLocalMotionEvent, toString, transformFromViewToWindowSpace, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, willNotDraw
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface icyllis.modernui.view.ViewParent
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch
-
Field Details
-
TRANSCRIPT_MODE_DISABLED
public static final int TRANSCRIPT_MODE_DISABLEDDisables the transcript mode.- See Also:
-
TRANSCRIPT_MODE_NORMAL
public static final int TRANSCRIPT_MODE_NORMALThe list will automatically scroll to the bottom when a data set change notification is received and only if the last item is already visible on screen.- See Also:
-
TRANSCRIPT_MODE_ALWAYS_SCROLL
public static final int TRANSCRIPT_MODE_ALWAYS_SCROLLThe list will automatically scroll to the bottom, no matter what items are currently visible.- See Also:
-
CHOICE_MODE_NONE
public static final int CHOICE_MODE_NONENormal list that does not indicate choices- See Also:
-
CHOICE_MODE_SINGLE
public static final int CHOICE_MODE_SINGLEThe list allows up to one choice- See Also:
-
CHOICE_MODE_MULTIPLE
public static final int CHOICE_MODE_MULTIPLEThe list allows multiple choices- See Also:
-
CHOICE_MODE_MULTIPLE_MODAL
public static final int CHOICE_MODE_MULTIPLE_MODALThe list allows multiple choices in a modal selection mode- See Also:
-
-
Constructor Details
-
AbsListView
-
-
Method Details
-
setAdapter
Sets the adapter that provides the data and the views to represent the data in this widget.- Specified by:
setAdapter
in classAdapterView<ListAdapter>
- Parameters:
adapter
- The adapter to use to create this view's content.
-
getCheckedItemCount
public int getCheckedItemCount()Returns the number of items currently selected. This will only be valid if the choice mode is notCHOICE_MODE_NONE
(default).To determine the specific items that are currently selected, use one of the
getChecked*
methods.- Returns:
- The number of items currently selected
- See Also:
-
isItemChecked
public boolean isItemChecked(int position) Returns the checked state of the specified position. The result is only valid if the choice mode has been set toCHOICE_MODE_SINGLE
orCHOICE_MODE_MULTIPLE
.- Parameters:
position
- The item whose checked state to return- Returns:
- The item's checked state or
false
if choice mode is invalid - See Also:
-
getCheckedItemPosition
public int getCheckedItemPosition()Returns the currently checked item. The result is only valid if the choice mode has been set toCHOICE_MODE_SINGLE
.- Returns:
- The position of the currently checked item or
AdapterView.INVALID_POSITION
if nothing is selected - See Also:
-
getCheckedItemPositions
Returns the set of checked items in the list. The result is only valid if the choice mode has not been set toCHOICE_MODE_NONE
.- Returns:
- A SparseBooleanArray which will return true for each call to
get(int position) where position is a checked position in the
list and false otherwise, or
null
if the choice mode is set toCHOICE_MODE_NONE
.
-
getCheckedItemIds
public long[] getCheckedItemIds()Returns the set of checked items ids. The result is only valid if the choice mode has not been set toCHOICE_MODE_NONE
and the adapter has stable IDs. (Adapter.hasStableIds()
==true
)- Returns:
- A new array which contains the id of each checked item in the list.
-
clearChoices
public void clearChoices()Clear any choices previously set -
setItemChecked
public void setItemChecked(int position, boolean value) Sets the checked state of the specified position. The is only valid if the choice mode has been set toCHOICE_MODE_SINGLE
orCHOICE_MODE_MULTIPLE
.- Parameters:
position
- The item whose checked state is to be checkedvalue
- The new checked state for the item
-
performItemClick
Description copied from class:AdapterView
Call the OnItemClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.- Overrides:
performItemClick
in classAdapterView<ListAdapter>
- Parameters:
view
- The view within the AdapterView that was clicked.position
- The position of the view in the adapter.id
- The row id of the item that was clicked.- Returns:
- True if there was an assigned OnItemClickListener that was called, false otherwise is returned.
-
getChoiceMode
public int getChoiceMode()- Returns:
- The current choice mode
- See Also:
-
setChoiceMode
public void setChoiceMode(int choiceMode) Defines the choice behavior for the List. By default, Lists do not have any choice behavior (CHOICE_MODE_NONE
). By setting the choiceMode toCHOICE_MODE_SINGLE
, the List allows up to one item to be in a chosen state. By setting the choiceMode toCHOICE_MODE_MULTIPLE
, the list allows any number of items to be chosen.- Parameters:
choiceMode
- One ofCHOICE_MODE_NONE
,CHOICE_MODE_SINGLE
, orCHOICE_MODE_MULTIPLE
-
setMultiChoiceModeListener
Set aAbsListView.MultiChoiceModeListener
that will manage the lifecycle of the selectionActionMode
. Only used when the choice mode is set toCHOICE_MODE_MULTIPLE_MODAL
.- Parameters:
listener
- Listener that will manage the selection mode- See Also:
-
setSmoothScrollbarEnabled
public void setSmoothScrollbarEnabled(boolean enabled) When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items. This however assumes that all list items have the same height. If you use a list in which items have different heights, the scrollbar will change appearance as the user scrolls through the list. To avoid this issue, you need to disable this property.When smooth scrollbar is disabled, the position and size of the scrollbar thumb is based solely on the number of items in the adapter and the position of the visible items inside the adapter. This provides a stable scrollbar as the user navigates through a list of items with varying heights.
- Parameters:
enabled
- Whether or not to enable smooth scrollbar.- See Also:
-
isSmoothScrollbarEnabled
public boolean isSmoothScrollbarEnabled()Returns the current state of the fast scroll feature.- Returns:
- True if smooth scrollbar is enabled is enabled, false otherwise.
- See Also:
-
setOnScrollListener
Set the listener that will receive notifications every time the list scrolls.- Parameters:
l
- the scroll listener
-
getFocusedRect
Description copied from class:View
When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this method.By default, the rectangle is the
View.getDrawingRect(Rect)
) of the view. However, if your view maintains some idea of internal selection, such as a cursor, or a selected row or column, you should override this method and fill in a more specific rectangle.- Overrides:
getFocusedRect
in classView
- Parameters:
r
- The rectangle to fill in, in this view's coordinates.
-
isStackFromBottom
public boolean isStackFromBottom()Indicates whether the content of this view is pinned to, or stacked from, the bottom edge.- Returns:
- true if the content is stacked from the bottom edge, false otherwise
-
setStackFromBottom
public void setStackFromBottom(boolean stackFromBottom) When stack from bottom is set to true, the list fills its content starting from the bottom of the view.- Parameters:
stackFromBottom
- true to pin the view's content to the bottom edge, false to pin the view's content to the top edge
-
onFocusChanged
protected void onFocusChanged(boolean gainFocus, int direction, @Nullable Rect previouslyFocusedRect) Description copied from class:View
Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from. When overriding, be sure to call up through to the super class so that the standard focus handling will occur.- Overrides:
onFocusChanged
in classView
- Parameters:
gainFocus
- True if the View has focus; false otherwise.direction
- The direction focus has moved when requestFocus() is called to give this view focus. Values areView.FOCUS_UP
,View.FOCUS_DOWN
,View.FOCUS_LEFT
,View.FOCUS_RIGHT
,View.FOCUS_FORWARD
, orView.FOCUS_BACKWARD
. It may not always apply, in which case use the default.previouslyFocusedRect
- The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will benull
otherwise.
-
requestLayout
public void requestLayout()Description copied from class:View
Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree. This should not be called while the view hierarchy is currently in a layout pass (View.isInLayout()
. If layout is happening, the request may be honored at the end of the current layout pass (and then layout will run again) or after the current frame is drawn and the next layout occurs.Subclasses which override this method should call the superclass method to handle possible request-during-layout errors correctly.
- Specified by:
requestLayout
in interfaceViewParent
- Overrides:
requestLayout
in classView
-
computeVerticalScrollExtent
protected int computeVerticalScrollExtent()Description copied from class:View
Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. This value is used to compute the length of the thumb within the scrollbar's track.
The range is expressed in arbitrary units that must be the same as the units used by
View.computeVerticalScrollRange()
andView.computeVerticalScrollOffset()
.The default extent is the drawing height of this view.
- Overrides:
computeVerticalScrollExtent
in classView
- Returns:
- the vertical extent of the scrollbar's thumb
- See Also:
-
computeVerticalScrollOffset
protected int computeVerticalScrollOffset()Description copied from class:View
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.
The range is expressed in arbitrary units that must be the same as the units used by
View.computeVerticalScrollRange()
andView.computeVerticalScrollExtent()
.The default offset is the scroll offset of this view.
- Overrides:
computeVerticalScrollOffset
in classView
- Returns:
- the vertical offset of the scrollbar's thumb
- See Also:
-
computeVerticalScrollRange
protected int computeVerticalScrollRange()Description copied from class:View
Compute the vertical range that the vertical scrollbar represents.
The range is expressed in arbitrary units that must be the same as the units used by
View.computeVerticalScrollExtent()
andView.computeVerticalScrollOffset()
.- Overrides:
computeVerticalScrollRange
in classView
- Returns:
- the total vertical range represented by the vertical scrollbar
The default range is the drawing height of this view.
- See Also:
-
onMeasure
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) Description copied from class:View
Measure the view and its content to determine the measured width and the measured height. This method is invoked byView.measure(int, int)
and should be overridden by subclasses to provide accurate and efficient measurement of their contents.CONTRACT: When overriding this method, you must call
View.setMeasuredDimension(int, int)
to store the measured width and height of this view. Failure to do so will trigger anIllegalStateException
, thrown byView.measure(int, int)
. Calling super.onMeasure() is a valid use.The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override the base one to provide better measurements of their content.
- Overrides:
onMeasure
in classView
- Parameters:
widthMeasureSpec
- width measure specification imposed by the parentMeasureSpec
heightMeasureSpec
- height measure specification imposed by the parentMeasureSpec
-
onLayout
protected void onLayout(boolean changed, int l, int t, int r, int b) Subclasses should NOT override this method butlayoutChildren()
instead.- Overrides:
onLayout
in classAdapterView<ListAdapter>
- Parameters:
changed
- This is a new size or position for this viewl
- Left position, relative to parentt
- Top position, relative to parentr
- Right position, relative to parentb
- Bottom position, relative to parent
-
layoutChildren
protected void layoutChildren()Subclasses must override this method to layout their children. -
getSelectedView
- Specified by:
getSelectedView
in classAdapterView<ListAdapter>
- Returns:
- The view corresponding to the currently selected item, or null if nothing is selected
-
getListPaddingTop
public int getListPaddingTop()List padding is the maximum of the normal view's padding and the padding of the selector.- Returns:
- The top list padding.
- See Also:
-
getListPaddingBottom
public int getListPaddingBottom()List padding is the maximum of the normal view's padding and the padding of the selector.- Returns:
- The bottom list padding.
- See Also:
-
getListPaddingLeft
public int getListPaddingLeft()List padding is the maximum of the normal view's padding and the padding of the selector.- Returns:
- The left list padding.
- See Also:
-
getListPaddingRight
public int getListPaddingRight()List padding is the maximum of the normal view's padding and the padding of the selector.- Returns:
- The right list padding.
- See Also:
-
dispatchDraw
Description copied from class:View
Draw the child views.- Overrides:
dispatchDraw
in classViewGroup
- Parameters:
canvas
- the canvas to draw content
-
internalSetPadding
protected void internalSetPadding(int left, int top, int right, int bottom) - Overrides:
internalSetPadding
in classViewGroup
-
onSizeChanged
protected void onSizeChanged(int w, int h, int oldw, int oldh) Description copied from class:View
Called when width or height changed- Overrides:
onSizeChanged
in classView
- Parameters:
w
- new widthh
- new heightoldw
- previous widtholdh
- previous height
-
shouldDrawSelector
@Internal public final boolean shouldDrawSelector() -
setDrawSelectorOnTop
public void setDrawSelectorOnTop(boolean onTop) Controls whether the selection highlight drawable should be drawn on top of the item or behind it.- Parameters:
onTop
- If true, the selector will be drawn on the item it is highlighting. The default is false.
-
isDrawSelectorOnTop
public boolean isDrawSelectorOnTop()Returns whether the selection highlight drawable should be drawn on top of the item or behind it.- Returns:
- true if selector is drawn on top, false otherwise
-
setSelector
-
getSelector
Returns the selectorDrawable
that is used to draw the selection in the list.- Returns:
- the drawable used to display the selector
-
setScrollIndicators
-
drawableStateChanged
protected void drawableStateChanged()Description copied from class:View
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.If the View has a StateListAnimator, it will also be called to run necessary state change animations.
Be sure to call through to the superclass when overriding this function.
- Overrides:
drawableStateChanged
in classViewGroup
- See Also:
-
verifyDrawable
Description copied from class:View
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled.Be sure to call through to the super class when overriding this function.
- Overrides:
verifyDrawable
in classView
- Parameters:
dr
- The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class.- Returns:
- boolean If true then the Drawable is being displayed in the view; else false and it is not allowed to animate.
- See Also:
-
onAttachedToWindow
protected void onAttachedToWindow()Description copied from class:View
This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called beforeView.onDraw(Canvas)
, however it may be called any time before the first onDraw -- including before or afterView.onMeasure(int, int)
.- Overrides:
onAttachedToWindow
in classView
- See Also:
-
onDetachedFromWindow
protected void onDetachedFromWindow()Description copied from class:View
This is called when the view is detached from a window. At this point it no longer has a surface for drawing.- Overrides:
onDetachedFromWindow
in classAdapterView<ListAdapter>
- See Also:
-
onWindowFocusChanged
public void onWindowFocusChanged(boolean hasWindowFocus) Description copied from class:View
Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.- Overrides:
onWindowFocusChanged
in classView
- Parameters:
hasWindowFocus
- True if the window containing this view now has focus, false otherwise.
-
onCancelPendingInputEvents
public void onCancelPendingInputEvents()Description copied from class:View
Called as the result of a call toView.cancelPendingInputEvents()
on this view or a parent view.This method is responsible for removing any pending high-level input events that were posted to the event queue to run later. Custom view classes that post their own deferred high-level events via
View.post(Runnable)
,View.postDelayed(Runnable, long)
orHandler
should override this method, callsuper.onCancelPendingInputEvents()
and remove those callbacks as appropriate.- Overrides:
onCancelPendingInputEvents
in classView
-
getContextMenuInfo
Description copied from class:View
Views should implement this if they have extra information to associate with the context menu. The return result is supplied as a parameter to theView.OnCreateContextMenuListener.onCreateContextMenu(ContextMenu, View, ContextMenuInfo)
callback.- Overrides:
getContextMenuInfo
in classView
- Returns:
- Extra information about the item for which the context menu should be shown. This information will vary across different subclasses of View.
-
showContextMenu
public boolean showContextMenu(float x, float y) Description copied from class:View
Shows the context menu for this view anchored to the specified view-relative coordinate.- Overrides:
showContextMenu
in classView
- Parameters:
x
- the X coordinate in pixels relative to the view to which the menu should be anchored, orFloat.NaN
to disable anchoringy
- the Y coordinate in pixels relative to the view to which the menu should be anchored, orFloat.NaN
to disable anchoring- Returns:
true
if the context menu was shown,false
otherwise
-
showContextMenuForChild
Description copied from interface:ViewParent
Shows the context menu for the specified view or its ancestors anchored to the specified view-relative coordinate.In most cases, a subclass does not need to override this. However, if the subclass is added directly to the window manager (for example,
ViewManager.addView(View, ViewGroup.LayoutParams)
) then it should override this and show the context menu.- Specified by:
showContextMenuForChild
in interfaceViewParent
- Overrides:
showContextMenuForChild
in classViewGroup
- Parameters:
originalView
- the source view where the context menu was first invokedx
- the X coordinate in pixels relative to the original view to which the menu should be anchored, orFloat.NaN
to disable anchoringy
- the Y coordinate in pixels relative to the original view to which the menu should be anchored, orFloat.NaN
to disable anchoring- Returns:
true
if the context menu was shown,false
otherwise
-
onKeyDown
Description copied from class:View
Default implementation: perform press of the view whenKeyEvent.KEY_ENTER
,KeyEvent.KEY_KP_ENTER
orKeyEvent.KEY_SPACE
is released, if the view is enabled and clickable. -
onKeyUp
Description copied from class:View
Default implementation: perform clicking of the view whenKeyEvent.KEY_ENTER
,KeyEvent.KEY_KP_ENTER
orKeyEvent.KEY_SPACE
is released. -
dispatchSetPressed
protected void dispatchSetPressed(boolean pressed) Description copied from class:View
Dispatch setPressed to all of this View's children.- Overrides:
dispatchSetPressed
in classViewGroup
- Parameters:
pressed
- The new pressed state- See Also:
-
dispatchDrawableHotspotChanged
public void dispatchDrawableHotspotChanged(float x, float y) Description copied from class:ViewGroup
Dispatches drawable hotspot changes to child views that meet at least one of the following criteria:- Returns
false
from bothView.isClickable()
andView.isLongClickable()
- Requests duplication of parent state via
View.setDuplicateParentStateEnabled(boolean)
- Overrides:
dispatchDrawableHotspotChanged
in classViewGroup
- Parameters:
x
- hotspot x coordinatey
- hotspot y coordinate- See Also:
- Returns
-
pointToPosition
public int pointToPosition(int x, int y) Maps a point to a position in the list.- Parameters:
x
- X in local coordinatey
- Y in local coordinate- Returns:
- The position of the item which contains the specified point, or
AdapterView.INVALID_POSITION
if the point does not intersect an item.
-
pointToRowId
public long pointToRowId(int x, int y) Maps a point to a the rowId of the item which intersects that point.- Parameters:
x
- X in local coordinatey
- Y in local coordinate- Returns:
- The rowId of the item which contains the specified point, or
AdapterView.INVALID_ROW_ID
if the point does not intersect an item.
-
onTouchModeChanged
public void onTouchModeChanged(boolean isInTouchMode) -
onTouchEvent
Description copied from class:View
Implement this method to handle touch screen motion events.If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling
View.performClick()
. This will ensure consistent system behavior.- Overrides:
onTouchEvent
in classView
- Parameters:
ev
- the touch event- Returns:
true
if the event was handled by the view,false
otherwise
-
onOverScrolled
protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) Description copied from class:View
Called byView.overScrollBy(int, int, int, int, int, int, int, int, boolean)
to respond to the results of an over-scroll operation.- Overrides:
onOverScrolled
in classView
- Parameters:
scrollX
- New X scroll value in pixelsscrollY
- New Y scroll value in pixelsclampedX
- True if scrollX was clamped to an over-scroll boundaryclampedY
- True if scrollY was clamped to an over-scroll boundary
-
onGenericMotionEvent
Description copied from class:View
Implement this method to handle generic motion events.Implementations of this method should check if this view ENABLED and CLICKABLE.
- Overrides:
onGenericMotionEvent
in classView
- Parameters:
event
- the generic motion event being processed.- Returns:
true
if the event was consumed by the view,false
otherwise
-
fling
public void fling(int velocityY) Initiate a fling with the given velocity.Applications can use this method to manually initiate a fling as if the user initiated it via touch interaction.
- Parameters:
velocityY
- Vertical velocity in pixels per second. Note that this is velocity of content, not velocity of a touch that initiated the fling.
-
onStartNestedScroll
Description copied from interface:ViewParent
React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.This method will be called in response to a descendant view invoking
View.startNestedScroll(int, int)
. Each parent up the view hierarchy will be given an opportunity to respond and claim the nested scrolling operation by returningtrue
.This method may be overridden by ViewParent implementations to indicate when the view is willing to support a nested scrolling operation that is about to begin. If it returns true, this ViewParent will become the target view's nested scrolling parent for the duration of the scroll operation in progress. When the nested scroll is finished this ViewParent will receive a call to
ViewParent.onStopNestedScroll(View, int)
.- Specified by:
onStartNestedScroll
in interfaceViewParent
- Overrides:
onStartNestedScroll
in classViewGroup
- Parameters:
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollaxes
- Flags consisting ofView.SCROLL_AXIS_HORIZONTAL
,View.SCROLL_AXIS_VERTICAL
or bothtype
- the type of input which cause this scroll event- Returns:
- true if this ViewParent accepts the nested scroll operation
-
onNestedScrollAccepted
Description copied from interface:ViewParent
React to the successful claiming of a nested scroll operation.This method will be called after
onStartNestedScroll
returns true. It offers an opportunity for the view and its superclasses to perform initial configuration for the nested scroll. Implementations of this method should always call their superclasses' implementation of this method if one is present.- Specified by:
onNestedScrollAccepted
in interfaceViewParent
- Overrides:
onNestedScrollAccepted
in classViewGroup
- Parameters:
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollaxes
- Flags consisting ofView.SCROLL_AXIS_HORIZONTAL
,View.SCROLL_AXIS_VERTICAL
or bothtype
- the type of input which cause this scroll event- See Also:
-
onNestedScroll
public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @NonNull int[] consumed) Description copied from interface:ViewParent
React to a nested scroll in progress.This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned
true
for a call toViewParent.onStartNestedScroll(View, View, int, int)
.Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.
This method is called when a nested scrolling child invokes
View.dispatchNestedScroll(int, int, int, int, int[], int, int[])
} or one of methods it overloads.An implementation must report how many pixels of the x and y scroll distances were consumed by this nested scrolling parent by adding the consumed distances to the
consumed
parameter.consumed
should also be passed up to it's nested scrolling parent so that the parent may also add any scroll distance it consumes. Index 0 corresponds to dx and index 1 corresponds to dy.- Specified by:
onNestedScroll
in interfaceViewParent
- Overrides:
onNestedScroll
in classViewGroup
- Parameters:
target
- The descendant view controlling the nested scrolldxConsumed
- Horizontal scroll distance in pixels already consumed by targetdyConsumed
- Vertical scroll distance in pixels already consumed by targetdxUnconsumed
- Horizontal scroll distance in pixels not consumed by targetdyUnconsumed
- Vertical scroll distance in pixels not consumed by targettype
- the type of input which cause this scroll eventconsumed
- Output. Upon this method returning, will contain the scroll distances consumed by this nested scrolling parent and the scroll distances consumed by any other parent up the view hierarchy- See Also:
-
onNestedFling
public boolean onNestedFling(@NonNull View target, float velocityX, float velocityY, boolean consumed) Description copied from interface:ViewParent
Request a fling from a nested scroll.This method signifies that a nested scrolling child has detected suitable conditions for a fling. Generally this means that a touch scroll has ended with a
velocity
in the direction of scrolling that meets or exceeds theminimum fling velocity
along a scrollable axis.If a nested scrolling child view would normally fling but it is at the edge of its own content, it can use this method to delegate the fling to its nested scrolling parent instead. The parent may optionally consume the fling or observe a child fling.
- Specified by:
onNestedFling
in interfaceViewParent
- Overrides:
onNestedFling
in classViewGroup
- Parameters:
target
- View that initiated the nested scrollvelocityX
- Horizontal velocity in pixels per secondvelocityY
- Vertical velocity in pixels per secondconsumed
- true if the child consumed the fling, false otherwise- Returns:
- true if this parent consumed or otherwise reacted to the fling
-
onDrawForeground
Description copied from class:View
Draw any foreground content for this view.Foreground content may consist of scroll bars, a
foreground
drawable or other view-specific decorations. The foreground is drawn on top of the primary view content.- Overrides:
onDrawForeground
in classView
- Parameters:
canvas
- the canvas to draw content
-
requestDisallowInterceptTouchEvent
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) Description copied from interface:ViewParent
Called when a child does not want this parent and its ancestors to intercept touch events withViewGroup.onInterceptTouchEvent(MotionEvent)
.This parent should pass this call onto its parents. This parent must obey this request for the duration of the touch (that is, only clear the flag after this parent has received an up or a cancel.
- Specified by:
requestDisallowInterceptTouchEvent
in interfaceViewParent
- Overrides:
requestDisallowInterceptTouchEvent
in classViewGroup
- Parameters:
disallowIntercept
- True if the child does not want the parent to intercept touch events.
-
onInterceptTouchEvent
Description copied from class:ViewGroup
Implement this method to intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point.Using this function takes some care, as it has a fairly complicated interaction with
View.onTouchEvent(MotionEvent)
, and using it requires implementing that method as well as this one in the correct way. Events will be received in the following order:- You will receive the down event here.
- The down event will be handled either by a child of this view group, or given to your own onTouchEvent() method to handle; this means you should implement onTouchEvent() to return true, so you will continue to see the rest of the gesture (instead of looking for a parent view to handle it). Also, by returning true from onTouchEvent(), you will not receive any following events in onInterceptTouchEvent() and all touch processing must happen in onTouchEvent() like normal.
- For as long as you return false from this function, each following event (up to and including the final up) will be delivered first here and then to the target's onTouchEvent().
- If you return true from here, you will not receive any
following events: the target view will receive the same event but
with the action
MotionEvent.ACTION_CANCEL
, and all further events will be delivered to your onTouchEvent() method and no longer appear here.
- Overrides:
onInterceptTouchEvent
in classViewGroup
- Parameters:
ev
- The motion event being dispatched down the hierarchy.- Returns:
- Return true to steal motion events from the children and have them dispatched to this ViewGroup through onTouchEvent(). The current target will receive an ACTION_CANCEL event, and no further messages will be delivered here.
-
addTouchables
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.- Overrides:
addTouchables
in classViewGroup
- Parameters:
views
- Touchable views found so far
-
setFriction
public void setFriction(float friction) The amount of friction applied to flings. The default value isinvalid reference
ViewConfiguration#getScrollFriction
-
setVelocityScale
public void setVelocityScale(float scale) Sets a scale factor for the fling velocity. The initial scale factor is 1.0.- Parameters:
scale
- The scale factor to multiply the velocity by.
-
smoothScrollToPosition
public void smoothScrollToPosition(int position) Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed.- Parameters:
position
- Scroll to this adapter position.
-
smoothScrollToPositionFromTop
public void smoothScrollToPositionFromTop(int position, int offset, int duration) Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayedoffset
pixels below the top edge of the view. If this is impossible, (e.g. the offset would scroll the first or last item beyond the boundaries of the list) it will get as close as possible. The scroll will takeduration
milliseconds to complete.- Parameters:
position
- Position to scroll tooffset
- Desired distance in pixels ofposition
from the top of the view when scrolling is finishedduration
- Number of milliseconds to use for the scroll
-
smoothScrollToPositionFromTop
public void smoothScrollToPositionFromTop(int position, int offset) Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayedoffset
pixels below the top edge of the view. If this is impossible, (e.g. the offset would scroll the first or last item beyond the boundaries of the list) it will get as close as possible.- Parameters:
position
- Position to scroll tooffset
- Desired distance in pixels ofposition
from the top of the view when scrolling is finished
-
smoothScrollToPosition
public void smoothScrollToPosition(int position, int boundPosition) Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed, but it will stop early if scrolling further would scroll boundPosition out of view.- Parameters:
position
- Scroll to this adapter position.boundPosition
- Do not scroll if it would move this adapter position out of view.
-
smoothScrollBy
public void smoothScrollBy(int distance, int duration) Smoothly scroll by distance pixels over duration milliseconds.- Parameters:
distance
- Distance to scroll in pixels.duration
- Duration of the scroll animation in milliseconds.
-
scrollListBy
public void scrollListBy(int y) Scrolls the list items within the view by a specified number of pixels.The actual amount of scroll is capped by the list content viewport height which is the list height minus top and bottom paddings minus one pixel.
- Parameters:
y
- the amount of pixels to scroll by vertically- See Also:
-
canScrollList
public boolean canScrollList(int direction) Check if the items in the list can be scrolled in a certain direction.- Parameters:
direction
- Negative to check scrolling up, positive to check scrolling down.- Returns:
- true if the list can be scrolled in the specified direction, false otherwise.
- See Also:
-
invalidateViews
public void invalidateViews()Causes all the views to be rebuilt and redrawn. -
handleDataChanged
protected void handleDataChanged() -
onFilterComplete
public void onFilterComplete(int count) Description copied from interface:Filter.FilterListener
Notifies the end of a filtering operation.
- Specified by:
onFilterComplete
in interfaceFilter.FilterListener
- Parameters:
count
- the number of values computed by the filter
-
generateDefaultLayoutParams
Description copied from class:ViewGroup
Returns a set of default layout parameters. These parameters are requested when the View passed toViewGroup.addView(View)
has no layout parameters already set. If null is returned, an exception is thrown from addView.- Overrides:
generateDefaultLayoutParams
in classViewGroup
- Returns:
- a set of default layout parameters
-
generateLayoutParams
Description copied from class:ViewGroup
Returns a safe set of layout parameters based on the supplied layout params. When a ViewGroup is passed a View whose layout params do not pass the test ofViewGroup.checkLayoutParams(LayoutParams)
, this method is invoked. This method should return a new set of layout params suitable for this ViewGroup, possibly by copying the appropriate attributes from the specified set of layout params.- Overrides:
generateLayoutParams
in classViewGroup
- Parameters:
p
- The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.- Returns:
- an instance of
ViewGroup.LayoutParams
or one of its descendants
-
checkLayoutParams
Description copied from class:ViewGroup
Check whether given params fit to this view group.See also
ViewGroup.generateLayoutParams(LayoutParams)
See alsoViewGroup.generateDefaultLayoutParams()
- Overrides:
checkLayoutParams
in classViewGroup
- Parameters:
p
- layout params to check- Returns:
- if params matched to this view group
-
setTranscriptMode
public void setTranscriptMode(int mode) Puts the list or grid into transcript mode. In this mode the list or grid will always scroll to the bottom to show new items.- Parameters:
mode
- the transcript mode to set- See Also:
-
getTranscriptMode
public int getTranscriptMode()Returns the current transcript mode. -
reclaimViews
Move all views (excluding headers and footers) held by this AbsListView into the supplied List. This includes views displayed on the screen as well as views stored in AbsListView's internal view recycler.- Parameters:
views
- A list into which to put the reclaimed views
-
setEdgeEffectColor
public void setEdgeEffectColor(int color) Sets the edge effect color for both top and bottom edge effects.- Parameters:
color
- The color for the edge effects.- See Also:
-
setBottomEdgeEffectColor
public void setBottomEdgeEffectColor(int color) Sets the bottom edge effect color.- Parameters:
color
- The color for the bottom edge effect.- See Also:
-
setTopEdgeEffectColor
public void setTopEdgeEffectColor(int color) Sets the top edge effect color.- Parameters:
color
- The color for the top edge effect.- See Also:
-
getTopEdgeEffectColor
public int getTopEdgeEffectColor()Returns the top edge effect color.- Returns:
- The top edge effect color.
- See Also:
-
getBottomEdgeEffectColor
public int getBottomEdgeEffectColor()Returns the bottom edge effect color.- Returns:
- The bottom edge effect color.
- See Also:
-
setRecyclerListener
Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse. This listener can be used to free resources associated to the View.- Parameters:
listener
- The recycler listener to be notified of views set aside in the recycler.- See Also:
-
setSelectionFromTop
public void setSelectionFromTop(int position, int y) Sets the selected item and positions the selection y pixels from the top edge of the ListView. (If in touch mode, the item will not be selected but it will still be positioned appropriately.)- Parameters:
position
- Index (starting at 0) of the data item to be selected.y
- The distance from the top edge of the ListView (plus padding) that the item will be positioned.
-