IT. Expert System.

Android Reference

AbsListView


android.widget

Class AbsListView

    • Field Detail

      • TRANSCRIPT_MODE_NORMAL

        public static final 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.
        See Also:
        setTranscriptMode(int), Constant Field Values
      • TRANSCRIPT_MODE_ALWAYS_SCROLL

        public static final int TRANSCRIPT_MODE_ALWAYS_SCROLL
        The list will automatically scroll to the bottom, no matter what items are currently visible.
        See Also:
        setTranscriptMode(int), Constant Field Values
      • CHOICE_MODE_NONE

        public static final int CHOICE_MODE_NONE
        Normal list that does not indicate choices
        See Also:
        Constant Field Values
      • CHOICE_MODE_SINGLE

        public static final int CHOICE_MODE_SINGLE
        The list allows up to one choice
        See Also:
        Constant Field Values
      • CHOICE_MODE_MULTIPLE

        public static final int CHOICE_MODE_MULTIPLE
        The list allows multiple choices
        See Also:
        Constant Field Values
      • CHOICE_MODE_MULTIPLE_MODAL

        public static final int CHOICE_MODE_MULTIPLE_MODAL
        The list allows multiple choices in a modal selection mode
        See Also:
        Constant Field Values
    • Method Detail

      • setOverScrollMode

        public void setOverScrollMode(int mode)
        Description copied from class: View
        Set the over-scroll mode for this view. Valid over-scroll modes are 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.
        Overrides:
        setOverScrollMode in class View
        Parameters:
        mode - The new over-scroll mode for this view.
      • setAdapter

        public void setAdapter(ListAdapter adapter)
        Sets the adapter that provides the data and the views to represent the data in this widget.
        Specified by:
        setAdapter in class AdapterView<ListAdapter>
        Parameters:
        adapter - The adapter to use to create this view's content.
      • 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 to CHOICE_MODE_SINGLE or CHOICE_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:
        setChoiceMode(int)
      • getCheckedItemPositions

        public SparseBooleanArray getCheckedItemPositions()
        Returns the set of checked items in the list. The result is only valid if the choice mode has not been set to CHOICE_MODE_NONE.
        Returns:
        A SparseBooleanArray which will return true for each call to get(int position) where position is a position in the list, or null if the choice mode is set to CHOICE_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 to CHOICE_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 to CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE.
        Parameters:
        position - The item whose checked state is to be checked
        value - The new checked state for the item
      • performItemClick

        public boolean performItemClick(View view,
                               int position,
                               long id)
        Description copied from class: AdapterView
        Call the OnItemClickListener, if it is defined.
        Overrides:
        performItemClick in class AdapterView<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(int)
      • setFastScrollEnabled

        public void setFastScrollEnabled(boolean enabled)
        Enables fast scrolling by letting the user quickly scroll through lists by dragging the fast scroll thumb. The adapter attached to the list may want to implement SectionIndexer if it wishes to display alphabet preview and jump between sections of the list.
        Parameters:
        enabled - whether or not to enable fast scrolling
        See Also:
        SectionIndexer, isFastScrollEnabled()
      • setFastScrollAlwaysVisible

        public void setFastScrollAlwaysVisible(boolean alwaysShow)
        Set whether or not the fast scroller should always be shown in place of the standard scrollbars. Fast scrollers shown in this way will not fade out and will be a permanent fixture within the list. Best combined with an inset scroll bar style that will ensure enough padding. This will enable fast scrolling if it is not already enabled.
        Parameters:
        alwaysShow - true if the fast scroller should always be displayed.
        See Also:
        View.setScrollBarStyle(int), setFastScrollEnabled(boolean)
      • isFastScrollAlwaysVisible

        public boolean isFastScrollAlwaysVisible()
        Returns true if the fast scroller is set to always show on this view rather than fade out when not in use.
        Returns:
        true if the fast scroller will always show.
        See Also:
        setFastScrollAlwaysVisible(boolean)
      • getVerticalScrollbarWidth

        public int getVerticalScrollbarWidth()
        Description copied from class: View
        Returns the width of the vertical scrollbar.
        Overrides:
        getVerticalScrollbarWidth in class View
        Returns:
        The width in pixels of the vertical scrollbar or 0 if there is no vertical scrollbar.
      • isFastScrollEnabled

        public boolean isFastScrollEnabled()
        Returns the current state of the fast scroll feature.
        Returns:
        true if fast scroll is enabled, false otherwise
        See Also:
        setFastScrollEnabled(boolean)
      • isVerticalScrollBarHidden

        protected boolean isVerticalScrollBarHidden()
        If fast scroll is visible, then don't draw the vertical scrollbar.
        Overrides:
        isVerticalScrollBarHidden in class View
        Returns:
        whether to temporarily hide the vertical scrollbar
      • 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:
        setSmoothScrollbarEnabled(boolean)
      • 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:
        setSmoothScrollbarEnabled(boolean)
      • setOnScrollListener

        public void setOnScrollListener(AbsListView.OnScrollListener l)
        Set the listener that will receive notifications every time the list scrolls.
        Parameters:
        l - the scroll listener
      • isScrollingCacheEnabled

        public boolean isScrollingCacheEnabled()
        Indicates whether the children's drawing cache is used during a scroll. By default, the drawing cache is enabled but this will consume more memory.
        Returns:
        true if the scrolling cache is enabled, false otherwise
        See Also:
        setScrollingCacheEnabled(boolean), View.setDrawingCacheEnabled(boolean)
      • setTextFilterEnabled

        public void setTextFilterEnabled(boolean textFilterEnabled)
        Enables or disables the type filter window. If enabled, typing when this view has focus will filter the children to match the users input. Note that the Adapter used by this view must implement the Filterable interface.
        Parameters:
        textFilterEnabled - true to enable type filtering, false otherwise
        See Also:
        Filterable
      • isTextFilterEnabled

        public boolean isTextFilterEnabled()
        Indicates whether type filtering is enabled for this view
        Returns:
        true if type filtering is enabled, false otherwise
        See Also:
        setTextFilterEnabled(boolean), Filterable
      • getFocusedRect

        public void getFocusedRect(Rect r)
        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(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.
        Overrides:
        getFocusedRect in class View
        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
      • onSaveInstanceState

        public Parcelable onSaveInstanceState()
        Description copied from class: View
        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. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

        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.

        Overrides:
        onSaveInstanceState in class View
        Returns:
        Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.
        See Also:
        View.onRestoreInstanceState(android.os.Parcelable), View.saveHierarchyState(android.util.SparseArray), View.dispatchSaveInstanceState(android.util.SparseArray), View.setSaveEnabled(boolean)
      • setFilterText

        public void setFilterText(String filterText)
        Sets the initial value for the text filter.
        Parameters:
        filterText - The text to use for the filter.
        See Also:
        setTextFilterEnabled(boolean)
      • getTextFilter

        public CharSequence getTextFilter()
        Returns the list's text filter, if available.
        Returns:
        the list's text filter or null if filtering isn't enabled
      • onFocusChanged

        protected void onFocusChanged(boolean gainFocus,
                          int direction,
                          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 class View
        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 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.
      • 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.
        Specified by:
        requestLayout in interface ViewParent
        Overrides:
        requestLayout in class View
      • getTopFadingEdgeStrength

        protected float getTopFadingEdgeStrength()
        Description copied from class: View
        Returns the strength, or intensity, of the top faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
        Overrides:
        getTopFadingEdgeStrength in class View
        Returns:
        the intensity of the top fade as a float between 0.0f and 1.0f
      • getBottomFadingEdgeStrength

        protected float getBottomFadingEdgeStrength()
        Description copied from class: View
        Returns the strength, or intensity, of the bottom faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
        Overrides:
        getBottomFadingEdgeStrength in class View
        Returns:
        the intensity of the bottom fade as a float between 0.0f and 1.0f
      • onLayout

        protected void onLayout(boolean changed,
                    int l,
                    int t,
                    int r,
                    int b)
        Subclasses should NOT override this method but layoutChildren() instead.
        Overrides:
        onLayout in class AdapterView<ListAdapter>
        Parameters:
        changed - This is a new size or position for this view
        l - Left position, relative to parent
        t - Top position, relative to parent
        r - Right position, relative to parent
        b - Bottom position, relative to parent
      • setFrame

        protected boolean setFrame(int left,
                       int top,
                       int right,
                       int bottom)
        Description copied from class: View
        Assign a size and position to this view. This is called from layout.
        Overrides:
        setFrame in class View
        Parameters:
        left - Left position, relative to parent
        top - Top position, relative to parent
        right - Right position, relative to parent
        bottom - Bottom position, relative to parent
        Returns:
        true if the new size and position are different than the previous ones
      • layoutChildren

        protected void layoutChildren()
        Subclasses must override this method to layout their children.
      • getSelectedView

        public View getSelectedView()
        Specified by:
        getSelectedView in class AdapterView<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:
        View.getPaddingTop(), getSelector()
      • 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:
        View.getPaddingBottom(), getSelector()
      • 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:
        View.getPaddingLeft(), getSelector()
      • 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:
        View.getPaddingRight(), getSelector()
      • dispatchDraw

        protected void dispatchDraw(Canvas canvas)
        Description copied from class: ViewGroup
        Called by draw to draw the child views. This may be overridden by derived classes to gain control just before its children are drawn (but after its own view has been drawn).
        Overrides:
        dispatchDraw in class ViewGroup
        Parameters:
        canvas - the canvas on which to draw the view
      • onSizeChanged

        protected void onSizeChanged(int w,
                         int h,
                         int oldw,
                         int oldh)
        Description copied from class: View
        This is called during layout when the size of this view has changed. If you were just added to the view hierarchy, you're called with the old values of 0.
        Overrides:
        onSizeChanged in class View
        Parameters:
        w - Current width of this view.
        h - Current height of this view.
        oldw - Old width of this view.
        oldh - Old height of this view.
      • 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.
      • setSelector

        public void setSelector(int resID)
        Set a Drawable that should be used to highlight the currently selected item.
        Parameters:
        resID - A Drawable resource to use as the selection highlight.
      • setSelector

        public void setSelector(Drawable sel)
      • getSelector

        public Drawable getSelector()
        Returns the selector Drawable that is used to draw the selection in the list.
        Returns:
        the drawable used to display the selector
      • setScrollIndicators

        public void setScrollIndicators(View up,
                               View down)
      • 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.

        Be sure to call through to the superclass when overriding this function.

        Overrides:
        drawableStateChanged in class ViewGroup
        See Also:
        Drawable.setState(int[])
      • onCreateDrawableState

        protected int[] onCreateDrawableState(int extraSpace)
        Description copied from class: View
        Generate the new Drawable state for this view. This is called by the view system when the cached Drawable state is determined to be invalid. To retrieve the current state, you should use View.getDrawableState().
        Overrides:
        onCreateDrawableState in class ViewGroup
        Parameters:
        extraSpace - if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.
        Returns:
        Returns an array holding the current Drawable state of the view.
        See Also:
        View.mergeDrawableStates(int[], int[])
      • verifyDrawable

        public boolean verifyDrawable(Drawable dr)
        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 class View
        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 than the Drawable is being displayed in the view; else false and it is not allowed to animate.
        See Also:
        View.unscheduleDrawable(android.graphics.drawable.Drawable), View.drawableStateChanged()
      • 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 class View
        Parameters:
        hasWindowFocus - True if the window containing this view now has focus, false otherwise.
      • getContextMenuInfo

        protected ContextMenu.ContextMenuInfo 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 the OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback.
        Overrides:
        getContextMenuInfo in class View
        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,
                              int metaState)
        Description copied from class: View
        Bring up the context menu for this view, referring to the item under the specified point.
        Overrides:
        showContextMenu in class View
        Parameters:
        x - The referenced x coordinate.
        y - The referenced y coordinate.
        metaState - The keyboard modifiers that were pressed.
        Returns:
        Whether a context menu was displayed.
      • onKeyDown

        public boolean onKeyDown(int keyCode,
                        KeyEvent event)
        Description copied from class: View
        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.

        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.

        Specified by:
        onKeyDown in interface KeyEvent.Callback
        Overrides:
        onKeyDown in class View
        Parameters:
        keyCode - A key code that represents the button pressed, from KeyEvent.
        event - The KeyEvent object that defines the button action.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • onKeyUp

        public boolean onKeyUp(int keyCode,
                      KeyEvent event)
        Description copied from class: View
        Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER 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.

        Specified by:
        onKeyUp in interface KeyEvent.Callback
        Overrides:
        onKeyUp in class View
        Parameters:
        keyCode - A key code that represents the button pressed, from KeyEvent.
        event - The KeyEvent object that defines the button action.
        Returns:
        If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
      • dispatchSetPressed

        protected void dispatchSetPressed(boolean pressed)
        Description copied from class: View
        Dispatch setPressed to all of this View's children.
        Overrides:
        dispatchSetPressed in class ViewGroup
        Parameters:
        pressed - The new pressed state
        See Also:
        View.setPressed(boolean)
      • pointToPosition

        public int pointToPosition(int x,
                          int y)
        Maps a point to a position in the list.
        Parameters:
        x - X in local coordinate
        y - 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 coordinate
        y - 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.
      • onTouchEvent

        public boolean onTouchEvent(MotionEvent ev)
        Description copied from class: View
        Implement this method to handle touch screen motion events.
        Overrides:
        onTouchEvent in class View
        Parameters:
        ev - The motion event.
        Returns:
        True if the event was handled, false otherwise.
      • onOverScrolled

        protected void onOverScrolled(int scrollX,
                          int scrollY,
                          boolean clampedX,
                          boolean clampedY)
        Description copied from class: View
        Called by View.overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation.
        Overrides:
        onOverScrolled in class View
        Parameters:
        scrollX - New X scroll value in pixels
        scrollY - New Y scroll value in pixels
        clampedX - True if scrollX was clamped to an over-scroll boundary
        clampedY - True if scrollY was clamped to an over-scroll boundary
      • onGenericMotionEvent

        public boolean onGenericMotionEvent(MotionEvent event)
        Description copied from class: View
        Implement this method to handle generic motion events.

        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.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
                 if (event.getAction() == MotionEvent.ACTION_MOVE) {
                     // process the joystick movement...
                     return true;
                 }
             }
             if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
                 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);
         }
        Overrides:
        onGenericMotionEvent in class View
        Parameters:
        event - The generic motion event being processed.
        Returns:
        True if the event was handled, false otherwise.
      • draw

        public void draw(Canvas canvas)
        Description copied from class: View
        Manually render this view (and all of its children) to the given Canvas. The view must have already done a full layout before this function is called. When implementing a view, implement View.onDraw(android.graphics.Canvas) instead of overriding this method. If you do need to override this method, call the superclass version.
        Overrides:
        draw in class View
        Parameters:
        canvas - The Canvas to which the View is rendered.
      • setOverScrollEffectPadding

        public void setOverScrollEffectPadding(int leftPadding,
                                      int rightPadding)
      • requestDisallowInterceptTouchEvent

        public void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
        Description copied from class: ViewGroup
        Called when a child does not want this parent and its ancestors to intercept touch events with 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.

        Specified by:
        requestDisallowInterceptTouchEvent in interface ViewParent
        Overrides:
        requestDisallowInterceptTouchEvent in class ViewGroup
        Parameters:
        disallowIntercept - True if the child does not want the parent to intercept touch events.
      • onInterceptTouchEvent

        public boolean onInterceptTouchEvent(MotionEvent ev)
        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:

        1. You will receive the down event here.
        2. 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.
        3. 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().
        4. 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 class ViewGroup
        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

        public 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.
        Overrides:
        addTouchables in class ViewGroup
        Parameters:
        views - Touchable views found so far
      • 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 displayed offset pixels from 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.
        Parameters:
        position - Position to scroll to
        offset - Desired distance in pixels of position from the top of the view when scrolling is finished
        duration - 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 displayed offset pixels from 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 to
        offset - Desired distance in pixels of position 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.
      • invalidateViews

        public void invalidateViews()
        Causes all the views to be rebuilt and redrawn.
      • handleDataChanged

        protected void handleDataChanged()
      • onDisplayHint

        protected void onDisplayHint(int hint)
        Description copied from class: View
        Gives this view a hint about whether is displayed or not. For instance, when a View moves out of the screen, it might receives a display hint indicating the view is not displayed. Applications should not rely on this hint as there is no guarantee that they will receive one.
        Overrides:
        onDisplayHint in class View
        Parameters:
        hint - A hint about whether or not this view is displayed: View.VISIBLE or View.INVISIBLE.
      • isInFilterMode

        protected boolean isInFilterMode()
        Description copied from class: AdapterView
        Indicates whether this view is in filter mode. Filter mode can for instance be enabled by a user when typing on the keyboard.
        Returns:
        True if the view is in filter mode, false otherwise.
      • onCreateInputConnection

        public InputConnection onCreateInputConnection(EditorInfo outAttrs)
        Return an InputConnection for editing of the filter text.
        Overrides:
        onCreateInputConnection in class View
        Parameters:
        outAttrs - Fill in with attribute information about the connection.
      • checkInputConnectionProxy

        public boolean checkInputConnectionProxy(View view)
        For filtering we proxy an input connection to an internal text editor, and this allows the proxying to happen.
        Overrides:
        checkInputConnectionProxy in class View
        Parameters:
        view - The View that is making the InputMethodManager call.
        Returns:
        Return true to allow the call, false to reject.
      • clearTextFilter

        public void clearTextFilter()
        Clear the text filter.
      • hasTextFilter

        public boolean hasTextFilter()
        Returns if the ListView currently has a text filter.
      • beforeTextChanged

        public void beforeTextChanged(CharSequence s,
                             int start,
                             int count,
                             int after)
        For our text watcher that is associated with the text filter. Does nothing.
        Specified by:
        beforeTextChanged in interface TextWatcher
      • onTextChanged

        public void onTextChanged(CharSequence s,
                         int start,
                         int before,
                         int count)
        For our text watcher that is associated with the text filter. Performs the actual filtering as the text changes, and takes care of hiding and showing the popup displaying the currently entered filter text.
        Specified by:
        onTextChanged in interface TextWatcher
      • afterTextChanged

        public void afterTextChanged(Editable s)
        For our text watcher that is associated with the text filter. Does nothing.
        Specified by:
        afterTextChanged in interface TextWatcher
      • generateDefaultLayoutParams

        protected ViewGroup.LayoutParams generateDefaultLayoutParams()
        Description copied from class: ViewGroup
        Returns a set of default layout parameters. These parameters are requested when the View passed to ViewGroup.addView(View) has no layout parameters already set. If null is returned, an exception is thrown from addView.
        Overrides:
        generateDefaultLayoutParams in class ViewGroup
        Returns:
        a set of default layout parameters or null
      • getSolidColor

        public int getSolidColor()
        Description copied from class: View
        Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges. Returning a non-zero color enables the view system to optimize the drawing of the fading edges. If you do return a non-zero color, the alpha should be set to 0xFF.
        Overrides:
        getSolidColor in class View
        Returns:
        The known solid color background for this view, or 0 if the color may vary
        See Also:
        View.setVerticalFadingEdgeEnabled(boolean), View.setHorizontalFadingEdgeEnabled(boolean)
      • setCacheColorHint

        public 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. Zero means that what's behind this object is translucent (non solid) or is not made of a single color. This hint will not affect any existing background drawable set on this view ( typically set via View.setBackgroundDrawable(Drawable)).
        Parameters:
        color - The background color
      • getCacheColorHint

        public 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
        Returns:
        The cache color hint
      • reclaimViews

        public void reclaimViews(List<View> views)
        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
      • setRemoteViewsAdapter

        public void setRemoteViewsAdapter(Intent intent)
        Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService through the specified intent.
        Parameters:
        intent - the intent used to identify the RemoteViewsService for the adapter to connect to.
      • setRemoteViewsOnClickHandler

        public void setRemoteViewsOnClickHandler(RemoteViews.OnClickHandler handler)
        Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews
        Parameters:
        handler - The OnClickHandler to use when inflating RemoteViews.
      • setRecyclerListener

        public void setRecyclerListener(AbsListView.RecyclerListener listener)
        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:
        AbsListView.RecycleBin, AbsListView.RecyclerListener


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 844 / . Delta: 0.08457 с