public abstract class AbsListView extends AdapterView<ListAdapter> implements TextWatcher, ViewTreeObserver.OnGlobalLayoutListener, Filter.FilterListener, ViewTreeObserver.OnTouchModeChangeListener, RemoteViewsAdapter.RemoteAdapterConnectionCallback
Modifier and Type | Class and Description |
---|---|
static class |
AbsListView.LayoutParams
AbsListView extends LayoutParams to provide a place to hold the view type.
|
static interface |
AbsListView.MultiChoiceModeListener
A MultiChoiceModeListener receives events for
CHOICE_MODE_MULTIPLE_MODAL . |
static interface |
AbsListView.OnScrollListener
Interface definition for a callback to be invoked when the list or grid
has been scrolled.
|
static interface |
AbsListView.RecyclerListener
A RecyclerListener is used to receive a notification whenever a View is placed
inside the RecycleBin's scrap heap.
|
static interface |
AbsListView.SelectionBoundsAdjuster
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.
|
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.DrawingCacheQuality, View.FindViewFlags, View.FocusableMode, View.FocusDirection, View.FocusRealDirection, View.LayoutDir, View.MeasureSpec, View.OnApplyWindowInsetsListener, 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.OnSystemUiVisibilityChangeListener, View.OnTouchListener, View.ResolvedLayoutDir, View.ScrollBarStyle, View.ScrollIndicators, View.TextAlignment, View.Visibility
NoCopySpan.Concrete
Modifier and Type | Field and Description |
---|---|
static int |
CHOICE_MODE_MULTIPLE
The list allows multiple choices
|
static int |
CHOICE_MODE_MULTIPLE_MODAL
The list allows multiple choices in a modal selection mode
|
static int |
CHOICE_MODE_NONE
Normal list that does not indicate choices
|
static int |
CHOICE_MODE_SINGLE
The list allows up to one choice
|
static int |
TRANSCRIPT_MODE_ALWAYS_SCROLL
The list will automatically scroll to the bottom, no matter what items
are currently visible.
|
static int |
TRANSCRIPT_MODE_DISABLED
Disables the transcript mode.
|
static int |
TRANSCRIPT_MODE_NORMAL
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.
|
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
CLIP_TO_PADDING_MASK, DEBUG_DRAW, FLAG_DISALLOW_INTERCEPT, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_DEFAULT, LAYOUT_MODE_OPTICAL_BOUNDS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ACCESSIBILITY_CURSOR_POSITION_UNDEFINED, ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DEBUG_LAYOUT_PROPERTY, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, 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_ACCESSIBILITY_NODE_PROVIDERS, 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, LAYOUT_DIRECTION_UNDEFINED, mAttributes, mBottom, mCachingFailed, mContext, mCurrentAnimation, mDebugViewAttributes, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mInputEventConsistencyVerifier, mLayoutParams, mLeft, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, mUserPaddingBottom, mUserPaddingLeft, mUserPaddingRight, NAVIGATION_BAR_TRANSIENT, NAVIGATION_BAR_TRANSLUCENT, NAVIGATION_BAR_TRANSPARENT, NAVIGATION_BAR_UNHIDE, 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, PUBLIC_STATUS_BAR_VISIBILITY_MASK, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, 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, 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, sPreserveMarginParamsInLayoutParamConversion, STATUS_BAR_DISABLE_BACK, STATUS_BAR_DISABLE_CLOCK, STATUS_BAR_DISABLE_EXPAND, STATUS_BAR_DISABLE_HOME, STATUS_BAR_DISABLE_NOTIFICATION_ALERTS, STATUS_BAR_DISABLE_NOTIFICATION_ICONS, STATUS_BAR_DISABLE_NOTIFICATION_TICKER, STATUS_BAR_DISABLE_RECENT, STATUS_BAR_DISABLE_SEARCH, STATUS_BAR_DISABLE_SYSTEM_INFO, STATUS_BAR_HIDDEN, STATUS_BAR_TRANSIENT, STATUS_BAR_TRANSLUCENT, STATUS_BAR_TRANSPARENT, STATUS_BAR_UNHIDE, STATUS_BAR_VISIBLE, SYSTEM_UI_CLEARABLE_FLAGS, 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_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, SYSTEM_UI_TRANSPARENT, 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, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
Constructor and Description |
---|
AbsListView(Context context) |
AbsListView(Context context,
AttributeSet attrs) |
AbsListView(Context context,
AttributeSet attrs,
int defStyleAttr) |
AbsListView(Context context,
AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
Modifier and Type | Method and Description |
---|---|
void |
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.
|
void |
afterTextChanged(Editable s)
For our text watcher that is associated with the text filter.
|
void |
beforeTextChanged(CharSequence s,
int start,
int count,
int after)
For our text watcher that is associated with the text filter.
|
boolean |
canScrollList(int direction)
Check if the items in the list can be scrolled in a certain direction.
|
boolean |
checkInputConnectionProxy(View view)
For filtering we proxy an input connection to an internal text editor,
and this allows the proxying to happen.
|
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p) |
void |
clearChoices()
Clear any choices previously set
|
void |
clearTextFilter()
Clear the text filter.
|
protected int |
computeVerticalScrollExtent()
Compute the vertical extent of the vertical scrollbar's thumb
within the vertical range.
|
protected int |
computeVerticalScrollOffset()
Compute the vertical offset of the vertical scrollbar's thumb
within the horizontal range.
|
protected int |
computeVerticalScrollRange()
Compute the vertical range that the vertical scrollbar represents.
|
void |
deferNotifyDataSetChanged()
This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not
connected yet.
|
protected void |
dispatchDraw(Canvas canvas)
Called by draw to 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:
Returns
false from both View.isClickable() and
View.isLongClickable()
Requests duplication of parent state via
View.setDuplicateParentStateEnabled(boolean)
|
protected void |
dispatchSetPressed(boolean pressed)
Dispatch setPressed to all of this View's children.
|
void |
draw(Canvas canvas)
Manually render this view (and all of its children) to the given Canvas.
|
protected void |
drawableStateChanged()
This function is called whenever the state of the view changes in such
a way that it impacts the state of drawables being shown.
|
protected void |
encodeProperties(ViewHierarchyEncoder encoder) |
View |
findViewByAccessibilityIdTraversal(int accessibilityId)
Performs the traversal to find a view by its unuque and stable accessibility id.
|
void |
fling(int velocityY)
Initiate a fling with the given velocity.
|
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams()
Returns a set of default layout parameters.
|
AbsListView.LayoutParams |
generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set.
|
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params.
|
CharSequence |
getAccessibilityClassName()
Return the class name of this object to be used for accessibility purposes.
|
protected float |
getBottomFadingEdgeStrength()
Returns the strength, or intensity, of the bottom faded edge.
|
protected int |
getBottomPaddingOffset()
Amount by which to extend the bottom fading region.
|
int |
getCacheColorHint()
When set to a non-zero value, the cache color hint indicates that this list is always drawn
on top of a solid, single-color, opaque background
|
int |
getCheckedItemCount()
Returns the number of items currently selected.
|
long[] |
getCheckedItemIds()
Returns the set of checked items ids.
|
int |
getCheckedItemPosition()
Returns the currently checked item.
|
SparseBooleanArray |
getCheckedItemPositions()
Returns the set of checked items in the list.
|
int |
getChoiceMode() |
protected ContextMenu.ContextMenuInfo |
getContextMenuInfo()
Views should implement this if they have extra information to associate
with the context menu.
|
void |
getFocusedRect(Rect r)
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.
|
protected int |
getLeftPaddingOffset()
Amount by which to extend the left fading region.
|
int |
getListPaddingBottom()
List padding is the maximum of the normal view's padding and the padding of the selector.
|
int |
getListPaddingLeft()
List padding is the maximum of the normal view's padding and the padding of the selector.
|
int |
getListPaddingRight()
List padding is the maximum of the normal view's padding and the padding of the selector.
|
int |
getListPaddingTop()
List padding is the maximum of the normal view's padding and the padding of the selector.
|
protected int |
getRightPaddingOffset()
Amount by which to extend the right fading region.
|
View |
getSelectedView() |
Drawable |
getSelector()
Returns the selector
Drawable that is used to draw the
selection in the list. |
int |
getSolidColor()
Override this if your view is known to always be drawn on top of a solid color background,
and needs to draw fading edges.
|
CharSequence |
getTextFilter()
Returns the list's text filter, if available.
|
protected float |
getTopFadingEdgeStrength()
Returns the strength, or intensity, of the top faded edge.
|
protected int |
getTopPaddingOffset()
Amount by which to extend the top fading region.
|
int |
getTranscriptMode()
Returns the current transcript mode.
|
int |
getVerticalScrollbarWidth()
Returns the width of the vertical scrollbar.
|
protected void |
handleDataChanged() |
protected boolean |
handleScrollBarDragging(MotionEvent event)
Handles scroll bar dragging by mouse input.
|
boolean |
hasTextFilter()
Returns if the ListView currently has a text filter.
|
protected void |
internalSetPadding(int left,
int top,
int right,
int bottom) |
void |
invalidateViews()
Causes all the views to be rebuilt and redrawn.
|
boolean |
isFastScrollAlwaysVisible()
Returns true if the fast scroller is set to always show on this view.
|
boolean |
isFastScrollEnabled()
Returns true if the fast scroller is enabled.
|
protected boolean |
isInFilterMode()
Indicates whether this view is in filter mode.
|
boolean |
isItemChecked(int position)
Returns the checked state of the specified position.
|
protected boolean |
isPaddingOffsetRequired()
If the View draws content inside its padding and enables fading edges,
it needs to support padding offsets.
|
boolean |
isScrollingCacheEnabled()
Indicates whether the children's drawing cache is used during a scroll.
|
boolean |
isSmoothScrollbarEnabled()
Returns the current state of the fast scroll feature.
|
boolean |
isStackFromBottom()
Indicates whether the content of this view is pinned to, or stacked from,
the bottom edge.
|
boolean |
isTextFilterEnabled()
Indicates whether type filtering is enabled for this view
|
protected boolean |
isVerticalScrollBarHidden()
If fast scroll is enabled, then don't draw the vertical scrollbar.
|
void |
jumpDrawablesToCurrentState()
Call
Drawable.jumpToCurrentState()
on all Drawable objects associated with this view. |
protected void |
layoutChildren()
Subclasses must override this method to layout their children.
|
protected void |
onAttachedToWindow()
This is called when the view is attached to a window.
|
void |
onCancelPendingInputEvents()
Called as the result of a call to
View.cancelPendingInputEvents() on this view or
a parent view. |
InputConnection |
onCreateInputConnection(EditorInfo outAttrs)
Return an InputConnection for editing of the filter text.
|
protected void |
onDetachedFromWindow()
This is called when the view is detached from a window.
|
protected void |
onDisplayHint(int hint)
Gives this view a hint about whether is displayed or not.
|
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.
|
void |
onGlobalLayout()
Callback method to be invoked when the global layout state or the visibility of views
within the view tree changes
|
void |
onInitializeAccessibilityNodeInfoForItem(View view,
int position,
AccessibilityNodeInfo info)
Initializes an
AccessibilityNodeInfo with information about a
particular item in the list. |
void |
onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) |
boolean |
onInterceptHoverEvent(MotionEvent event)
Implement this method to intercept hover events before they are handled
by child views.
|
boolean |
onInterceptTouchEvent(MotionEvent ev)
Implement this method to intercept all touch screen motion events.
|
boolean |
onKeyDown(int keyCode,
KeyEvent event)
Default implementation of
KeyEvent.Callback.onKeyDown() : perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable. |
boolean |
onKeyUp(int keyCode,
KeyEvent event)
Default implementation of
KeyEvent.Callback.onKeyUp() : perform clicking of the view
when KeyEvent.KEYCODE_DPAD_CENTER , KeyEvent.KEYCODE_ENTER
or KeyEvent.KEYCODE_SPACE is released. |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
Subclasses should NOT override this method but
layoutChildren() 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)
React to a nested scroll in progress.
|
void |
onNestedScrollAccepted(View child,
View target,
int axes)
React to the successful claiming of a nested scroll operation.
|
protected void |
onOverScrolled(int scrollX,
int scrollY,
boolean clampedX,
boolean clampedY)
Called by
View.overScrollBy(int, int, int, int, int, int, int, int, boolean) to
respond to the results of an over-scroll operation. |
boolean |
onRemoteAdapterConnected()
Called back when the adapter connects to the RemoteViewsService.
|
void |
onRemoteAdapterDisconnected()
Called back when the adapter disconnects from the RemoteViewsService.
|
void |
onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously
been generated by
View.onSaveInstanceState() . |
void |
onRtlPropertiesChanged(int layoutDirection)
Called when any RTL property (layout direction or text direction or text alignment) has
been changed.
|
Parcelable |
onSaveInstanceState()
Hook allowing a view to generate a representation of its internal state
that can later be used to create a new instance with that same state.
|
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh)
This is called during layout when the size of this view has changed.
|
boolean |
onStartNestedScroll(View child,
View target,
int nestedScrollAxes)
React to a descendant view initiating a nestable scroll operation, claiming the
nested scroll operation if appropriate.
|
void |
onTextChanged(CharSequence s,
int start,
int before,
int count)
For our text watcher that is associated with the text filter.
|
boolean |
onTouchEvent(MotionEvent ev)
Implement this method to handle touch screen motion events.
|
void |
onTouchModeChanged(boolean isInTouchMode)
Callback method to be invoked when the touch mode changes.
|
void |
onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
|
boolean |
performAccessibilityActionInternal(int action,
Bundle arguments) |
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 with
ViewGroup.onInterceptTouchEvent(MotionEvent) . |
void |
requestLayout()
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 |
sendAccessibilityEventInternal(int eventType) |
void |
setAdapter(ListAdapter adapter)
Sets the adapter that provides the data and the views to represent the data
in this widget.
|
void |
setCacheColorHint(int color)
When set to a non-zero value, the cache color hint indicates that this list is always drawn
on top of a solid, single-color, opaque background.
|
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 |
setFastScrollAlwaysVisible(boolean alwaysShow)
Set whether or not the fast scroller should always be shown in place of
the standard scroll bars.
|
void |
setFastScrollEnabled(boolean enabled)
Specifies whether fast scrolling is enabled or disabled.
|
void |
setFastScrollStyle(int styleResId)
Specifies the style of the fast scroller decorations.
|
void |
setFilterText(String filterText)
Sets the initial value for the text filter.
|
protected boolean |
setFrame(int left,
int top,
int right,
int bottom)
Assign a size and position to this view.
|
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 |
setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener listener)
Set a
AbsListView.MultiChoiceModeListener that will manage the lifecycle of the
selection ActionMode . |
void |
setOnScrollListener(AbsListView.OnScrollListener l)
Set the listener that will receive notifications every time the list scrolls.
|
void |
setOverScrollMode(int mode)
Set the over-scroll mode for this view.
|
void |
setRecyclerListener(AbsListView.RecyclerListener listener)
Sets the recycler listener to be notified whenever a View is set aside in
the recycler for later reuse.
|
void |
setRemoteViewsAdapter(Intent intent)
Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService
through the specified intent.
|
void |
setRemoteViewsOnClickHandler(RemoteViews.OnClickHandler handler)
Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews
|
void |
setScrollBarStyle(int style)
Specify the style of the scrollbars.
|
void |
setScrollIndicators(View up,
View down) |
void |
setScrollingCacheEnabled(boolean enabled)
Enables or disables the children's drawing cache during a scroll.
|
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 |
setSelector(int resID)
Set a Drawable that should be used to highlight the currently selected item.
|
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 |
setTextFilterEnabled(boolean textFilterEnabled)
Enables or disables the type filter window.
|
void |
setTranscriptMode(int mode)
Puts the list or grid into transcript mode.
|
void |
setVelocityScale(float scale)
Sets a scale factor for the fling velocity.
|
void |
setVerticalScrollbarPosition(int position)
Set the position of the vertical scroll bar.
|
boolean |
showContextMenu()
Shows the context menu for this view.
|
boolean |
showContextMenu(float x,
float y)
Shows the context menu for this view anchored to the specified
view-relative coordinate.
|
boolean |
showContextMenuForChild(View originalView)
Shows the context menu for the specified view or its ancestors.
|
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 |
verifyDrawable(Drawable dr)
If your view subclass is displaying its own Drawable objects, it should
override this function and return true for any Drawable it is
displaying.
|
addView, addView, addView, addView, canAnimate, dispatchPopulateAccessibilityEventInternal, dispatchRestoreInstanceState, dispatchSaveInstanceState, getAdapter, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, onInitializeAccessibilityEventInternal, onRequestSendAccessibilityEventInternal, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener, setSelection
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTransientView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, buildTouchDispatchChildList, captureTransitioningViews, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, createSnapshot, damageChild, damageChildDeferred, damageChildInParent, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchActivityResult, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchGetDisplayList, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findNamedViews, findViewByPredicateTraversal, findViewsWithText, findViewTraversal, findViewWithTagTraversal, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, getTransientView, getTransientViewCount, getTransientViewIndex, hasFocus, hasFocusable, hasHoveredChild, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isShowingContextMenuWithCoords, isTransformedTouchPointInView, isTransitionGroup, layout, makeOptionalFitsSystemWindows, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onChildVisibilityChanged, onCreateDrawableState, onDebugDraw, onDebugDrawMargins, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onSetLayoutParams, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeTransientView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestFocus, requestSendAccessibilityEvent, requestTransitionStart, requestTransparentRegion, resetResolvedDrawables, resetResolvedLayoutDirection, resetResolvedPadding, resetResolvedTextAlignment, resetResolvedTextDirection, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, transformPointToViewLocal, updateViewLayout
addFocusables, addFrameMetricsListener, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, applyDrawableToTransparentRegion, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canHaveDisplayList, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, clearAccessibilityFocus, clearAnimation, combineMeasuredStates, computeFitSystemWindows, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeOpaqueFlags, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createAccessibilityNodeInfoInternal, createContextMenu, damageInParent, debug, debugIndent, destroyDrawingCache, destroyHardwareResources, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerEvent, dispatchPopulateAccessibilityEvent, drawableHotspotChanged, encode, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewWithTag, fitsSystemWindows, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilitySelectionEnd, getAccessibilitySelectionStart, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAccessibilityViewId, getAccessibilityWindowId, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBoundsOnScreen, getBoundsOnScreen, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFadeHeight, getFadeTop, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHardwareRenderer, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollFactor, getHotspotBounds, getId, getImportantForAccessibility, getInverseMatrix, getIterableTextForAccessibility, getIteratorForGranularity, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOpticalInsets, getOutlineProvider, getOutsets, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollFactor, getViewRootImpl, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowDisplayFrame, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOpaqueScrollbars, hasOverlappingRendering, hasShadow, hasWindowFocus, includeForAccessibility, inflate, initializeFadingEdge, initializeFadingEdgeInternal, initializeScrollbars, initializeScrollbarsInternal, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, invalidateParentCaches, invalidateParentIfNeeded, invalidateParentIfNeededAndWasQuickRejected, isAccessibilityFocused, isAccessibilitySelectionExtendable, isActionableForAccessibility, isActivated, isAssistBlocked, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isForegroundInsidePadding, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInScrollingContainer, isInTouchMode, isLaidOut, isLayoutDirectionInherited, isLayoutDirectionResolved, isLayoutModeOptical, isLayoutRequested, isLayoutRtl, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPressed, isRootNamespace, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentInherited, isTextAlignmentResolved, isTextDirectionInherited, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUser, isVisibleToUser, measure, mergeDrawableStates, notifySubtreeAccessibilityStateChangedIfNeeded, notifyViewAccessibilityStateChangedIfNeeded, offsetLeftAndRight, offsetTopAndBottom, onActivityResult, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCheckIsTextEditor, onCloseSystemDialogs, onConfigurationChanged, onCreateContextMenu, onDetachedFromWindowInternal, onDragEvent, onDraw, onDrawForeground, onDrawHorizontalScrollBar, onDrawScrollBars, onDrawVerticalScrollBar, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusLost, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onPopulateAccessibilityEvent, onPopulateAccessibilityEventInternal, onProvideStructure, onProvideVirtualStructure, onRenderNodeDetached, onResolveDrawables, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityAggregated, onVisibilityChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, outputDirtyFlags, overScrollBy, performAccessibilityAction, performButtonActionOnTouchDown, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, pointInView, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, recomputePadding, refreshDrawableState, removeCallbacks, removeFrameMetricsListener, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestAccessibilityFocus, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestKeyboardShortcuts, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resetPaddingToInitialValues, resetRtlProperties, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, sendAccessibilityEventUncheckedInternal, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilitySelection, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAnimationMatrix, setAssistBlocked, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDisabledSystemUiVisibility, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setIsRootNamespace, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOpticalInsets, setOutlineProvider, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealClip, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTagInternal, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, startActionMode, startActionMode, startActivityForResult, startAnimation, startDrag, startDragAndDrop, startMovingTask, startNestedScroll, stopNestedScroll, toGlobalMotionEvent, toLocalMotionEvent, toString, transformFromViewToWindowSpace, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDisplayListIfDirty, updateDragShadow, 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
public static final int TRANSCRIPT_MODE_DISABLED
setTranscriptMode(int)
,
Constant Field Valuespublic static final int TRANSCRIPT_MODE_NORMAL
setTranscriptMode(int)
,
Constant Field Valuespublic static final int TRANSCRIPT_MODE_ALWAYS_SCROLL
setTranscriptMode(int)
,
Constant Field Valuespublic static final int CHOICE_MODE_NONE
public static final int CHOICE_MODE_SINGLE
public static final int CHOICE_MODE_MULTIPLE
public static final int CHOICE_MODE_MULTIPLE_MODAL
public AbsListView(Context context)
public AbsListView(Context context, AttributeSet attrs)
public AbsListView(Context context, AttributeSet attrs, int defStyleAttr)
public AbsListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
public void setOverScrollMode(int mode)
View
View.OVER_SCROLL_ALWAYS
(default), View.OVER_SCROLL_IF_CONTENT_SCROLLS
(allow over-scrolling only if the view content is larger than the container),
or View.OVER_SCROLL_NEVER
.
Setting the over-scroll mode of a view will have an effect only if the
view is capable of scrolling.setOverScrollMode
in class View
mode
- The new over-scroll mode for this view.public void setAdapter(ListAdapter adapter)
setAdapter
in class AdapterView<ListAdapter>
adapter
- The adapter to use to create this view's content.public int getCheckedItemCount()
CHOICE_MODE_NONE
(default).
To determine the specific items that are currently selected, use one of
the getChecked*
methods.
getCheckedItemPosition()
,
getCheckedItemPositions()
,
getCheckedItemIds()
public boolean isItemChecked(int position)
CHOICE_MODE_SINGLE
or CHOICE_MODE_MULTIPLE
.position
- The item whose checked state to returnfalse
if choice mode
is invalidsetChoiceMode(int)
public int getCheckedItemPosition()
CHOICE_MODE_SINGLE
.AdapterView.INVALID_POSITION
if nothing is selectedsetChoiceMode(int)
public SparseBooleanArray getCheckedItemPositions()
CHOICE_MODE_NONE
.null
if the choice
mode is set to CHOICE_MODE_NONE
.public long[] getCheckedItemIds()
CHOICE_MODE_NONE
and the adapter
has stable IDs. (Adapter.hasStableIds()
== true
)public void clearChoices()
public void setItemChecked(int position, boolean value)
CHOICE_MODE_SINGLE
or
CHOICE_MODE_MULTIPLE
.position
- The item whose checked state is to be checkedvalue
- The new checked state for the itempublic boolean performItemClick(View view, int position, long id)
AdapterView
performItemClick
in class AdapterView<ListAdapter>
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.public int getChoiceMode()
setChoiceMode(int)
public void setChoiceMode(int choiceMode)
CHOICE_MODE_NONE
). By setting the choiceMode to CHOICE_MODE_SINGLE
, the
List allows up to one item to be in a chosen state. By setting the choiceMode to
CHOICE_MODE_MULTIPLE
, the list allows any number of items to be chosen.choiceMode
- One of CHOICE_MODE_NONE
, CHOICE_MODE_SINGLE
, or
CHOICE_MODE_MULTIPLE
public void setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener listener)
AbsListView.MultiChoiceModeListener
that will manage the lifecycle of the
selection ActionMode
. Only used when the choice mode is set to
CHOICE_MODE_MULTIPLE_MODAL
.listener
- Listener that will manage the selection modesetChoiceMode(int)
public void setFastScrollEnabled(boolean enabled)
When fast scrolling is enabled, the user can quickly scroll through lists by dragging the fast scroll thumb.
If the adapter backing this list implements SectionIndexer
, the
fast scroller will display section header previews as the user scrolls.
Additionally, the user will be able to quickly jump between sections by
tapping along the length of the scroll bar.
enabled
- true to enable fast scrolling, false otherwiseSectionIndexer
,
isFastScrollEnabled()
public void setFastScrollStyle(int styleResId)
styleResId
- style resource containing fast scroller propertiesandroid.R.styleable#FastScroll
public void setFastScrollAlwaysVisible(boolean alwaysShow)
Fast scrollers shown in this way will not fade out and will be a permanent fixture within the list. This is best combined with an inset scroll bar style to ensure the scroll bar does not overlap content.
alwaysShow
- true if the fast scroller should always be displayed,
false otherwisesetScrollBarStyle(int)
,
setFastScrollEnabled(boolean)
public boolean isFastScrollAlwaysVisible()
setFastScrollAlwaysVisible(boolean)
public int getVerticalScrollbarWidth()
View
getVerticalScrollbarWidth
in class View
public boolean isFastScrollEnabled()
setFastScrollEnabled(boolean)
public void setVerticalScrollbarPosition(int position)
View
View.SCROLLBAR_POSITION_DEFAULT
, View.SCROLLBAR_POSITION_LEFT
or
View.SCROLLBAR_POSITION_RIGHT
.setVerticalScrollbarPosition
in class View
position
- Where the vertical scroll bar should be positioned.public void setScrollBarStyle(int style)
View
Specify the style of the scrollbars. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use SCROLLBARS_INSIDE_OVERLAY or SCROLLBARS_INSIDE_INSET. If you want them to appear at the edge of the view, ignoring the padding, then you can use SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.
setScrollBarStyle
in class View
style
- the style of the scrollbars. Should be one of
SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET,
SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.View.SCROLLBARS_INSIDE_OVERLAY
,
View.SCROLLBARS_INSIDE_INSET
,
View.SCROLLBARS_OUTSIDE_OVERLAY
,
View.SCROLLBARS_OUTSIDE_INSET
protected boolean isVerticalScrollBarHidden()
isVerticalScrollBarHidden
in class View
public void setSmoothScrollbarEnabled(boolean enabled)
enabled
- Whether or not to enable smooth scrollbar.setSmoothScrollbarEnabled(boolean)
public boolean isSmoothScrollbarEnabled()
setSmoothScrollbarEnabled(boolean)
public void setOnScrollListener(AbsListView.OnScrollListener l)
l
- the scroll listenerpublic void sendAccessibilityEventInternal(int eventType)
sendAccessibilityEventInternal
in class View
Note: Called from the default {@link AccessibilityDelegate}.
public CharSequence getAccessibilityClassName()
View
AccessibilityNodeInfo.setClassName
.getAccessibilityClassName
in class AdapterView<ListAdapter>
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info)
onInitializeAccessibilityNodeInfoInternal
in class AdapterView<ListAdapter>
Note: Called from the default {@link AccessibilityDelegate}.
public boolean performAccessibilityActionInternal(int action, Bundle arguments)
performAccessibilityActionInternal
in class View
Note: Called from the default {@link AccessibilityDelegate}.
public View findViewByAccessibilityIdTraversal(int accessibilityId)
View
findViewByAccessibilityIdTraversal
in class ViewGroup
accessibilityId
- The accessibility id.public boolean isScrollingCacheEnabled()
setScrollingCacheEnabled(boolean)
,
View.setDrawingCacheEnabled(boolean)
public void setScrollingCacheEnabled(boolean enabled)
ViewGroup.setChildrenDrawingCacheEnabled(boolean)
.enabled
- true to enable the scroll cache, false otherwiseisScrollingCacheEnabled()
,
View.setDrawingCacheEnabled(boolean)
public void setTextFilterEnabled(boolean textFilterEnabled)
Adapter
used by this view must implement the
Filterable
interface.textFilterEnabled
- true to enable type filtering, false otherwiseFilterable
public boolean isTextFilterEnabled()
setTextFilterEnabled(boolean)
,
Filterable
public void getFocusedRect(Rect r)
View
View.getDrawingRect(android.graphics.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.getFocusedRect
in class View
r
- The rectangle to fill in, in this view's coordinates.public boolean isStackFromBottom()
public void setStackFromBottom(boolean stackFromBottom)
stackFromBottom
- true to pin the view's content to the bottom edge,
false to pin the view's content to the top edgepublic Parcelable onSaveInstanceState()
View
Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.
onSaveInstanceState
in class View
View.onRestoreInstanceState(android.os.Parcelable)
,
View.saveHierarchyState(android.util.SparseArray)
,
View.dispatchSaveInstanceState(android.util.SparseArray)
,
View.setSaveEnabled(boolean)
public void onRestoreInstanceState(Parcelable state)
View
View.onSaveInstanceState()
. This function will never be called with a
null state.onRestoreInstanceState
in class View
state
- The frozen state that had previously been returned by
View.onSaveInstanceState()
.View.onSaveInstanceState()
,
View.restoreHierarchyState(android.util.SparseArray)
,
View.dispatchRestoreInstanceState(android.util.SparseArray)
public void setFilterText(String filterText)
filterText
- The text to use for the filter.setTextFilterEnabled(boolean)
public CharSequence getTextFilter()
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
View
onFocusChanged
in class View
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 are
View.FOCUS_UP
, View.FOCUS_DOWN
, View.FOCUS_LEFT
,
View.FOCUS_RIGHT
, View.FOCUS_FORWARD
, or View.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 be null
otherwise.public void requestLayout()
View
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.
requestLayout
in interface ViewParent
requestLayout
in class View
protected int computeVerticalScrollExtent()
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()
and
View.computeVerticalScrollOffset()
.
The default extent is the drawing height of this view.
computeVerticalScrollExtent
in class View
View.computeVerticalScrollRange()
,
View.computeVerticalScrollOffset()
,
ScrollBarDrawable
protected int computeVerticalScrollOffset()
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()
and
View.computeVerticalScrollExtent()
.
The default offset is the scroll offset of this view.
computeVerticalScrollOffset
in class View
View.computeVerticalScrollRange()
,
View.computeVerticalScrollExtent()
,
ScrollBarDrawable
protected int computeVerticalScrollRange()
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()
and
View.computeVerticalScrollOffset()
.
computeVerticalScrollRange
in class View
The default range is the drawing height of this view.
View.computeVerticalScrollExtent()
,
View.computeVerticalScrollOffset()
,
ScrollBarDrawable
protected float getTopFadingEdgeStrength()
View
getTopFadingEdgeStrength
in class View
protected float getBottomFadingEdgeStrength()
View
getBottomFadingEdgeStrength
in class View
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
View
Measure the view and its content to determine the measured width and the
measured height. This method is invoked by View.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 an
IllegalStateException
, thrown by
View.measure(int, int)
. Calling the superclass'
View.onMeasure(int, int)
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 View.onMeasure(int, int)
to provide better measurements of
their content.
If this method is overridden, it is the subclass's responsibility to make
sure the measured height and width are at least the view's minimum height
and width (View.getSuggestedMinimumHeight()
and
View.getSuggestedMinimumWidth()
).
onMeasure
in class View
widthMeasureSpec
- horizontal space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec
.heightMeasureSpec
- vertical space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec
.View.getMeasuredWidth()
,
View.getMeasuredHeight()
,
View.setMeasuredDimension(int, int)
,
View.getSuggestedMinimumHeight()
,
View.getSuggestedMinimumWidth()
,
View.MeasureSpec.getMode(int)
,
View.MeasureSpec.getSize(int)
protected void onLayout(boolean changed, int l, int t, int r, int b)
layoutChildren()
instead.onLayout
in class AdapterView<ListAdapter>
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 parentprotected boolean setFrame(int left, int top, int right, int bottom)
View
protected void layoutChildren()
public View getSelectedView()
getSelectedView
in class AdapterView<ListAdapter>
public int getListPaddingTop()
View.getPaddingTop()
,
getSelector()
public int getListPaddingBottom()
View.getPaddingBottom()
,
getSelector()
public int getListPaddingLeft()
View.getPaddingLeft()
,
getSelector()
public int getListPaddingRight()
View.getPaddingRight()
,
getSelector()
public void onInitializeAccessibilityNodeInfoForItem(View view, int position, AccessibilityNodeInfo info)
AccessibilityNodeInfo
with information about a
particular item in the list.view
- View representing the list item.position
- Position of the list item within the adapter.info
- Node info to populate.protected void dispatchDraw(Canvas canvas)
View
dispatchDraw
in class ViewGroup
canvas
- the canvas on which to draw the viewprotected boolean isPaddingOffsetRequired()
View
isPaddingOffsetRequired
in class View
View.getLeftPaddingOffset()
,
View.getRightPaddingOffset()
,
View.getTopPaddingOffset()
,
View.getBottomPaddingOffset()
protected int getLeftPaddingOffset()
View
View.isPaddingOffsetRequired()
returns true.getLeftPaddingOffset
in class View
View.isPaddingOffsetRequired()
protected int getTopPaddingOffset()
View
View.isPaddingOffsetRequired()
returns true.getTopPaddingOffset
in class View
View.isPaddingOffsetRequired()
protected int getRightPaddingOffset()
View
View.isPaddingOffsetRequired()
returns true.getRightPaddingOffset
in class View
View.isPaddingOffsetRequired()
protected int getBottomPaddingOffset()
View
View.isPaddingOffsetRequired()
returns true.getBottomPaddingOffset
in class View
View.isPaddingOffsetRequired()
protected void internalSetPadding(int left, int top, int right, int bottom)
internalSetPadding
in class ViewGroup
protected void onSizeChanged(int w, int h, int oldw, int oldh)
View
onSizeChanged
in class View
w
- Current width of this view.h
- Current height of this view.oldw
- Old width of this view.oldh
- Old height of this view.public void setDrawSelectorOnTop(boolean onTop)
onTop
- If true, the selector will be drawn on the item it is highlighting. The default
is false.public void setSelector(@DrawableRes int resID)
resID
- A Drawable resource to use as the selection highlight.public void setSelector(Drawable sel)
public Drawable getSelector()
Drawable
that is used to draw the
selection in the list.protected void drawableStateChanged()
View
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.
drawableStateChanged
in class ViewGroup
Drawable.setState(int[])
public boolean verifyDrawable(Drawable dr)
View
Be sure to call through to the super class when overriding this function.
verifyDrawable
in class View
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.View.unscheduleDrawable(android.graphics.drawable.Drawable)
,
View.drawableStateChanged()
public void jumpDrawablesToCurrentState()
View
Drawable.jumpToCurrentState()
on all Drawable objects associated with this view.
Also calls StateListAnimator.jumpToCurrentState()
if there is a StateListAnimator
attached to this view.
jumpDrawablesToCurrentState
in class ViewGroup
protected void onAttachedToWindow()
View
View.onDraw(android.graphics.Canvas)
,
however it may be called any time before the first onDraw -- including
before or after View.onMeasure(int, int)
.onAttachedToWindow
in class ViewGroup
View.onDetachedFromWindow()
protected void onDetachedFromWindow()
View
onDetachedFromWindow
in class AdapterView<ListAdapter>
View.onAttachedToWindow()
public void onWindowFocusChanged(boolean hasWindowFocus)
View
onWindowFocusChanged
in class View
hasWindowFocus
- True if the window containing this view now has
focus, false otherwise.public void onRtlPropertiesChanged(int layoutDirection)
View
onRtlPropertiesChanged
in class View
layoutDirection
- the direction of the layoutView.LAYOUT_DIRECTION_LTR
,
View.LAYOUT_DIRECTION_RTL
public void onCancelPendingInputEvents()
View
View.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)
or
Handler
should override this method, call
super.onCancelPendingInputEvents()
and remove those callbacks as appropriate.
onCancelPendingInputEvents
in class View
protected ContextMenu.ContextMenuInfo getContextMenuInfo()
View
OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo)
callback.getContextMenuInfo
in class View
public boolean showContextMenu()
View
showContextMenu
in class View
true
if the context menu was shown, false
otherwiseView.showContextMenu(float, float)
public boolean showContextMenu(float x, float y)
View
showContextMenu
in class View
x
- the X coordinate in pixels relative to the view to which the
menu should be anchored, or Float.NaN
to disable anchoringy
- the Y coordinate in pixels relative to the view to which the
menu should be anchored, or Float.NaN
to disable anchoringtrue
if the context menu was shown, false
otherwisepublic boolean showContextMenuForChild(View originalView)
ViewParent
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, android.view.ViewGroup.LayoutParams)
)
then it should override this and show the context menu.
showContextMenuForChild
in interface ViewParent
showContextMenuForChild
in class ViewGroup
originalView
- the source view where the context menu was first
invokedtrue
if the context menu was shown, false
otherwiseViewParent.showContextMenuForChild(View, float, float)
public boolean showContextMenuForChild(View originalView, float x, float y)
ViewParent
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, android.view.ViewGroup.LayoutParams)
)
then it should override this and show the context menu.
If a subclass overrides this method it should also override
ViewParent.showContextMenuForChild(View)
.
showContextMenuForChild
in interface ViewParent
showContextMenuForChild
in class ViewGroup
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, or Float.NaN
to
disable anchoringy
- the Y coordinate in pixels relative to the original view to
which the menu should be anchored, or Float.NaN
to
disable anchoringtrue
if the context menu was shown, false
otherwisepublic boolean onKeyDown(int keyCode, KeyEvent event)
View
KeyEvent.Callback.onKeyDown()
: perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER
or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable.
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyDown
in interface KeyEvent.Callback
onKeyDown
in class View
keyCode
- a key code that represents the button pressed, from
KeyEvent
event
- the KeyEvent object that defines the button actionpublic boolean onKeyUp(int keyCode, KeyEvent event)
View
KeyEvent.Callback.onKeyUp()
: perform clicking of the view
when KeyEvent.KEYCODE_DPAD_CENTER
, KeyEvent.KEYCODE_ENTER
or KeyEvent.KEYCODE_SPACE
is released.
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyUp
in interface KeyEvent.Callback
onKeyUp
in class View
keyCode
- A key code that represents the button pressed, from
KeyEvent
.event
- The KeyEvent object that defines the button action.protected void dispatchSetPressed(boolean pressed)
View
dispatchSetPressed
in class ViewGroup
pressed
- The new pressed stateView.setPressed(boolean)
public void dispatchDrawableHotspotChanged(float x, float y)
ViewGroup
false
from both View.isClickable()
and
View.isLongClickable()
View.setDuplicateParentStateEnabled(boolean)
dispatchDrawableHotspotChanged
in class ViewGroup
x
- hotspot x coordinatey
- hotspot y coordinateView.drawableHotspotChanged(float, float)
public int pointToPosition(int x, int y)
x
- X in local coordinatey
- Y in local coordinateAdapterView.INVALID_POSITION
if the point does not intersect an item.public long pointToRowId(int x, int y)
x
- X in local coordinatey
- Y in local coordinateAdapterView.INVALID_ROW_ID
if the point does not intersect an item.public void onTouchModeChanged(boolean isInTouchMode)
ViewTreeObserver.OnTouchModeChangeListener
onTouchModeChanged
in interface ViewTreeObserver.OnTouchModeChangeListener
isInTouchMode
- True if the view hierarchy is now in touch mode, false otherwise.protected boolean handleScrollBarDragging(MotionEvent event)
View
handleScrollBarDragging
in class View
event
- The motion event.public boolean onTouchEvent(MotionEvent ev)
View
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,
including:
ACTION_CLICK
when
accessibility features are enabled
onTouchEvent
in class View
ev
- The motion event.protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY)
View
View.overScrollBy(int, int, int, int, int, int, int, int, boolean)
to
respond to the results of an over-scroll operation.onOverScrolled
in class View
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 boundarypublic boolean onGenericMotionEvent(MotionEvent event)
View
Generic motion events describe joystick movements, mouse hovers, track pad
touches, scroll wheel movements and other input events. The
source
of the motion event specifies
the class of input that was received. Implementations of this method
must examine the bits in the source before processing the event.
The following code example shows how this is done.
Generic motion events with source class InputDevice.SOURCE_CLASS_POINTER
are delivered to the view under the pointer. All other generic motion events are
delivered to the focused view.
public boolean onGenericMotionEvent(MotionEvent event) { if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) { if (event.getAction() == MotionEvent.ACTION_MOVE) { // process the joystick movement... return true; } } if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { switch (event.getAction()) { case MotionEvent.ACTION_HOVER_MOVE: // process the mouse hover movement... return true; case MotionEvent.ACTION_SCROLL: // process the scroll wheel movement... return true; } } return super.onGenericMotionEvent(event); }
onGenericMotionEvent
in class View
event
- The generic motion event being processed.public void fling(int velocityY)
Applications can use this method to manually initiate a fling as if the user initiated it via touch interaction.
velocityY
- Vertical velocity in pixels per second. Note that this is velocity of
content, not velocity of a touch that initiated the fling.public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes)
ViewParent
This method will be called in response to a descendant view invoking
View.startNestedScroll(int)
. Each parent up the view hierarchy will be
given an opportunity to respond and claim the nested scrolling operation by returning
true
.
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)
.
onStartNestedScroll
in interface ViewParent
onStartNestedScroll
in class ViewGroup
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollnestedScrollAxes
- Flags consisting of View.SCROLL_AXIS_HORIZONTAL
,
View.SCROLL_AXIS_VERTICAL
or bothpublic void onNestedScrollAccepted(View child, View target, int axes)
ViewParent
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 superclass's
implementation of this method if one is present.
onNestedScrollAccepted
in interface ViewParent
onNestedScrollAccepted
in class ViewGroup
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollaxes
- Flags consisting of View.SCROLL_AXIS_HORIZONTAL
,
View.SCROLL_AXIS_VERTICAL
or bothViewParent.onStartNestedScroll(View, View, int)
,
ViewParent.onStopNestedScroll(View)
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
ViewParent
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 to
ViewParent.onStartNestedScroll(View, View, 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.
onNestedScroll
in interface ViewParent
onNestedScroll
in class ViewGroup
target
- The descendent 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 targetpublic boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed)
ViewParent
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
the minimum 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.
onNestedFling
in interface ViewParent
onNestedFling
in class ViewGroup
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 otherwisepublic void draw(Canvas canvas)
View
View.onDraw(android.graphics.Canvas)
instead of overriding this method.
If you do need to override this method, call the superclass version.public void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
ViewParent
ViewGroup.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.
requestDisallowInterceptTouchEvent
in interface ViewParent
requestDisallowInterceptTouchEvent
in class ViewGroup
disallowIntercept
- True if the child does not want the parent to
intercept touch events.public boolean onInterceptHoverEvent(MotionEvent event)
ViewGroup
This method is called before dispatching a hover event to a child of
the view group or to the view group's own View.onHoverEvent(android.view.MotionEvent)
to allow
the view group a chance to intercept the hover event.
This method can also be used to watch all pointer motions that occur within
the bounds of the view group even when the pointer is hovering over
a child of the view group rather than over the view group itself.
The view group can prevent its children from receiving hover events by
implementing this method and returning true
to indicate
that it would like to intercept hover events. The view group must
continuously return true
from ViewGroup.onInterceptHoverEvent(android.view.MotionEvent)
for as long as it wishes to continue intercepting hover events from
its children.
Interception preserves the invariant that at most one view can be hovered at a time by transferring hover focus from the currently hovered child to the view group or vice-versa as needed.
If this method returns true
and a child is already hovered, then the
child view will first receive a hover exit event and then the view group
itself will receive a hover enter event in View.onHoverEvent(android.view.MotionEvent)
.
Likewise, if this method had previously returned true
to intercept hover
events and instead returns false
while the pointer is hovering
within the bounds of one of a child, then the view group will first receive a
hover exit event in View.onHoverEvent(android.view.MotionEvent)
and then the hovered child will
receive a hover enter event.
The default implementation handles mouse hover on the scroll bars.
onInterceptHoverEvent
in class ViewGroup
event
- The motion event that describes the hover.public boolean onInterceptTouchEvent(MotionEvent ev)
ViewGroup
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:
MotionEvent.ACTION_CANCEL
, and all further
events will be delivered to your onTouchEvent() method and no longer
appear here.
onInterceptTouchEvent
in class ViewGroup
ev
- The motion event being dispatched down the hierarchy.public void addTouchables(ArrayList<View> views)
addTouchables
in class ViewGroup
views
- Touchable views found so farpublic void setFriction(float friction)
ViewConfiguration.getScrollFriction()
.public void setVelocityScale(float scale)
scale
- The scale factor to multiply the velocity by.public void smoothScrollToPosition(int position)
position
- Scroll to this adapter position.public void smoothScrollToPositionFromTop(int position, int offset, int duration)
offset
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 take duration
milliseconds to complete.position
- Position to scroll tooffset
- Desired distance in pixels of position
from the top
of the view when scrolling is finishedduration
- Number of milliseconds to use for the scrollpublic void smoothScrollToPositionFromTop(int position, int offset)
offset
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.position
- Position to scroll tooffset
- Desired distance in pixels of position
from the top
of the view when scrolling is finishedpublic void smoothScrollToPosition(int position, int boundPosition)
position
- Scroll to this adapter position.boundPosition
- Do not scroll if it would move this adapter
position out of view.public void smoothScrollBy(int distance, int duration)
distance
- Distance to scroll in pixels.duration
- Duration of the scroll animation in milliseconds.public void scrollListBy(int y)
y
- the amount of pixels to scroll by verticallycanScrollList(int)
public boolean canScrollList(int direction)
direction
- Negative to check scrolling up, positive to check
scrolling down.scrollListBy(int)
public void invalidateViews()
protected void handleDataChanged()
protected void onDisplayHint(int hint)
View
onDisplayHint
in class View
hint
- A hint about whether or not this view is displayed:
View.VISIBLE
or View.INVISIBLE
.protected boolean isInFilterMode()
AdapterView
public InputConnection onCreateInputConnection(EditorInfo outAttrs)
onCreateInputConnection
in class View
outAttrs
- Fill in with attribute information about the connection.public boolean checkInputConnectionProxy(View view)
checkInputConnectionProxy
in class View
view
- The View that is making the InputMethodManager call.public void clearTextFilter()
public boolean hasTextFilter()
public void onGlobalLayout()
ViewTreeObserver.OnGlobalLayoutListener
onGlobalLayout
in interface ViewTreeObserver.OnGlobalLayoutListener
public void beforeTextChanged(CharSequence s, int start, int count, int after)
beforeTextChanged
in interface TextWatcher
public void onTextChanged(CharSequence s, int start, int before, int count)
onTextChanged
in interface TextWatcher
public void afterTextChanged(Editable s)
afterTextChanged
in interface TextWatcher
public void onFilterComplete(int count)
Filter.FilterListener
Notifies the end of a filtering operation.
onFilterComplete
in interface Filter.FilterListener
count
- the number of values computed by the filterprotected ViewGroup.LayoutParams generateDefaultLayoutParams()
ViewGroup
ViewGroup.addView(View)
has no layout parameters
already set. If null is returned, an exception is thrown from addView.generateDefaultLayoutParams
in class ViewGroup
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
ViewGroup
ViewGroup.checkLayoutParams(android.view.ViewGroup.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.generateLayoutParams
in class ViewGroup
p
- The layout parameters to convert into a suitable set of layout parameters
for this ViewGroup.ViewGroup.LayoutParams
or one
of its descendantspublic AbsListView.LayoutParams generateLayoutParams(AttributeSet attrs)
ViewGroup
generateLayoutParams
in class ViewGroup
attrs
- the attributes to build the layout parameters fromViewGroup.LayoutParams
or one
of its descendantsprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
checkLayoutParams
in class ViewGroup
public void setTranscriptMode(int mode)
mode
- the transcript mode to setTRANSCRIPT_MODE_DISABLED
,
TRANSCRIPT_MODE_NORMAL
,
TRANSCRIPT_MODE_ALWAYS_SCROLL
public int getTranscriptMode()
public int getSolidColor()
View
getSolidColor
in class View
View.setVerticalFadingEdgeEnabled(boolean)
,
View.setHorizontalFadingEdgeEnabled(boolean)
public void setCacheColorHint(int color)
View.setBackgroundDrawable(Drawable)
).color
- The background colorpublic int getCacheColorHint()
public void reclaimViews(List<View> views)
views
- A list into which to put the reclaimed viewspublic void setRemoteViewsAdapter(Intent intent)
intent
- the intent used to identify the RemoteViewsService for the adapter to connect to.public void setRemoteViewsOnClickHandler(RemoteViews.OnClickHandler handler)
handler
- The OnClickHandler to use when inflating RemoteViews.public void deferNotifyDataSetChanged()
deferNotifyDataSetChanged
in interface RemoteViewsAdapter.RemoteAdapterConnectionCallback
public boolean onRemoteAdapterConnected()
onRemoteAdapterConnected
in interface RemoteViewsAdapter.RemoteAdapterConnectionCallback
public void onRemoteAdapterDisconnected()
onRemoteAdapterDisconnected
in interface RemoteViewsAdapter.RemoteAdapterConnectionCallback
public void setRecyclerListener(AbsListView.RecyclerListener listener)
listener
- The recycler listener to be notified of views set aside
in the recycler.AbsListView.RecycleBin
,
AbsListView.RecyclerListener
public void setSelectionFromTop(int position, int y)
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.protected void encodeProperties(ViewHierarchyEncoder encoder)
View
encodeProperties
in class AdapterView<ListAdapter>