IT. Expert System.

Android Reference

ListView


android.widget

Class ListView

    • Method Detail

      • getMaxScrollAmount

        public int getMaxScrollAmount()
        Returns:
        The maximum amount a list view will scroll in response to an arrow event.
      • addHeaderView

        public void addHeaderView(View v,
                         Object data,
                         boolean isSelectable)
        Add a fixed view to appear at the top of the list. If addHeaderView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want.

        NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.

        Parameters:
        v - The view to add.
        data - Data to associate with this view
        isSelectable - whether the item is selectable
      • addHeaderView

        public void addHeaderView(View v)
        Add a fixed view to appear at the top of the list. If addHeaderView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want.

        NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.

        Parameters:
        v - The view to add.
      • getHeaderViewsCount

        public int getHeaderViewsCount()
        Description copied from class: AbsListView
        Returns the number of header views in the list. Header views are special views at the top of the list that should not be recycled during a layout.
        Returns:
        The number of header views, 0 in the default implementation.
      • removeHeaderView

        public boolean removeHeaderView(View v)
        Removes a previously-added header view.
        Parameters:
        v - The view to remove
        Returns:
        true if the view was removed, false if the view was not a header view
      • addFooterView

        public void addFooterView(View v,
                         Object data,
                         boolean isSelectable)
        Add a fixed view to appear at the bottom of the list. If addFooterView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want.

        NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.

        Parameters:
        v - The view to add.
        data - Data to associate with this view
        isSelectable - true if the footer view can be selected
      • addFooterView

        public void addFooterView(View v)
        Add a fixed view to appear at the bottom of the list. If addFooterView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want.

        NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.

        Parameters:
        v - The view to add.
      • getFooterViewsCount

        public int getFooterViewsCount()
        Description copied from class: AbsListView
        Returns the number of footer views in the list. Footer views are special views at the bottom of the list that should not be recycled during a layout.
        Returns:
        The number of footer views, 0 in the default implementation.
      • removeFooterView

        public boolean removeFooterView(View v)
        Removes a previously-added footer view.
        Parameters:
        v - The view to remove
        Returns:
        true if the view was removed, false if the view was not a footer view
      • 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.
        Overrides:
        setRemoteViewsAdapter in class AbsListView
        Parameters:
        intent - the intent used to identify the RemoteViewsService for the adapter to connect to.
      • setAdapter

        public void setAdapter(ListAdapter adapter)
        Sets the data behind this ListView. The adapter passed to this method may be wrapped by a WrapperListAdapter, depending on the ListView features currently in use. For instance, adding headers and/or footers will cause the adapter to be wrapped.
        Overrides:
        setAdapter in class AbsListView
        Parameters:
        adapter - The ListAdapter which is responsible for maintaining the data backing this list and for producing a view to represent an item in that data set.
        See Also:
        getAdapter()
      • requestChildRectangleOnScreen

        public boolean requestChildRectangleOnScreen(View child,
                                            Rect rect,
                                            boolean immediate)
        Description copied from class: ViewGroup
        Called when a child of this group wants a particular rectangle to be positioned onto the screen. ViewGroups overriding this can trust that:
        • child will be a direct child of this group
        • rectangle will be in the child's coordinates

        ViewGroups overriding this should uphold the contract:

        • nothing will change if the rectangle is already visible
        • the view port will be scrolled only just enough to make the rectangle visible
          Specified by:
          requestChildRectangleOnScreen in interface ViewParent
          Overrides:
          requestChildRectangleOnScreen in class ViewGroup
          Parameters:
          child - The direct child making the request.
          rect - The rectangle in the child's coordinates the child wishes to be on the screen.
          immediate - True to forbid animated or delayed scrolling, false otherwise
          Returns:
          Whether the group scrolled to handle the operation
        • smoothScrollToPosition

          public void smoothScrollToPosition(int position)
          Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed.
          Overrides:
          smoothScrollToPosition in class AbsListView
          Parameters:
          position - Scroll to this adapter position.
        • smoothScrollByOffset

          public void smoothScrollByOffset(int offset)
          Smoothly scroll to the specified adapter position offset. The view will scroll such that the indicated position is displayed.
          Parameters:
          offset - The amount to offset from the adapter position to scroll to.
        • 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 AbsListView
          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.
        • recycleOnMeasure

          protected boolean recycleOnMeasure()
          Returns:
          True to recycle the views used to measure this ListView in UNSPECIFIED/AT_MOST modes, false otherwise.
        • layoutChildren

          protected void layoutChildren()
          Description copied from class: AbsListView
          Subclasses must override this method to layout their children.
          Overrides:
          layoutChildren in class AbsListView
        • canAnimate

          protected boolean canAnimate()
          Description copied from class: ViewGroup
          Indicates whether the view group has the ability to animate its children after the first layout.
          Overrides:
          canAnimate in class AdapterView<ListAdapter>
          Returns:
          true if the children can be animated, false otherwise
        • setSelection

          public void setSelection(int position)
          Sets the currently selected item. If in touch mode, the item will not be selected but it will still be positioned appropriately. If the specified selection position is less than 0, then the item at position 0 will be selected.
          Specified by:
          setSelection in class AdapterView<ListAdapter>
          Parameters:
          position - Index (starting at 0) of the data item to be selected.
        • setSelectionFromTop

          public void setSelectionFromTop(int position,
                                 int y)
          Sets the selected item and positions the selection y pixels from the top edge of the ListView. (If in touch mode, the item will not be selected but it will still be positioned appropriately.)
          Parameters:
          position - Index (starting at 0) of the data item to be selected.
          y - The distance from the top edge of the ListView (plus padding) that the item will be positioned.
        • setSelectionAfterHeaderView

          public void setSelectionAfterHeaderView()
          setSelectionAfterHeaderView set the selection to be the first list item after the header views.
        • dispatchKeyEvent

          public boolean dispatchKeyEvent(KeyEvent event)
          Description copied from class: ViewGroup
          Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.
          Overrides:
          dispatchKeyEvent in class ViewGroup
          Parameters:
          event - The key event to be dispatched.
          Returns:
          True if the event was handled, false otherwise.
        • 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 AbsListView
          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.
        • onKeyMultiple

          public boolean onKeyMultiple(int keyCode,
                              int repeatCount,
                              KeyEvent event)
          Description copied from class: View
          Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).

          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:
          onKeyMultiple in interface KeyEvent.Callback
          Overrides:
          onKeyMultiple in class View
          Parameters:
          keyCode - A key code that represents the button pressed, from KeyEvent.
          repeatCount - The number of times the action was made.
          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 AbsListView
          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.
        • setItemsCanFocus

          public void setItemsCanFocus(boolean itemsCanFocus)
          Indicates that the views created by the ListAdapter can contain focusable items.
          Parameters:
          itemsCanFocus - true if items can get focus, false otherwise
        • getItemsCanFocus

          public boolean getItemsCanFocus()
          Returns:
          Whether the views created by the ListAdapter can contain focusable items.
        • isOpaque

          public boolean isOpaque()
          Description copied from class: View
          Indicates whether this View is opaque. An opaque View guarantees that it will draw all the pixels overlapping its bounds using a fully opaque color. Subclasses of View should override this method whenever possible to indicate whether an instance is opaque. Opaque Views are treated in a special way by the View hierarchy, possibly allowing it to perform optimizations during invalidate/draw passes.
          Overrides:
          isOpaque in class View
          Returns:
          True if this View is guaranteed to be fully opaque, false otherwise.
        • setCacheColorHint

          public void setCacheColorHint(int color)
          Description copied from class: AbsListView
          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)).
          Overrides:
          setCacheColorHint in class AbsListView
          Parameters:
          color - The background color
        • 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 AbsListView
          Parameters:
          canvas - the canvas on which to draw the view
        • drawChild

          protected boolean drawChild(Canvas canvas,
                          View child,
                          long drawingTime)
          Description copied from class: ViewGroup
          Draw one child of this View Group. This method is responsible for getting the canvas in the right state. This includes clipping, translating so that the child's scrolled origin is at 0, 0, and applying any animation transformations.
          Overrides:
          drawChild in class ViewGroup
          Parameters:
          canvas - The canvas on which to draw the child
          child - Who to draw
          drawingTime - The time at which draw is occurring
          Returns:
          True if an invalidate() was issued
        • getDivider

          public Drawable getDivider()
          Returns the drawable that will be drawn between each item in the list.
          Returns:
          the current drawable drawn between list elements
        • setDivider

          public void setDivider(Drawable divider)
          Sets the drawable that will be drawn between each item in the list. If the drawable does not have an intrinsic height, you should also call setDividerHeight(int)
          Parameters:
          divider - The drawable to use.
        • getDividerHeight

          public int getDividerHeight()
          Returns:
          Returns the height of the divider that will be drawn between each item in the list.
        • setDividerHeight

          public void setDividerHeight(int height)
          Sets the height of the divider that will be drawn between each item in the list. Calling this will override the intrinsic height as set by setDivider(Drawable)
          Parameters:
          height - The new height of the divider in pixels.
        • setOverscrollHeader

          public void setOverscrollHeader(Drawable header)
          Sets the drawable that will be drawn above all other list content. This area can become visible when the user overscrolls the list.
          Parameters:
          header - The drawable to use
        • getOverscrollHeader

          public Drawable getOverscrollHeader()
          Returns:
          The drawable that will be drawn above all other list content
        • setOverscrollFooter

          public void setOverscrollFooter(Drawable footer)
          Sets the drawable that will be drawn below all other list content. This area can become visible when the user overscrolls the list, or when the list's content does not fully fill the container area.
          Parameters:
          footer - The drawable to use
        • getOverscrollFooter

          public Drawable getOverscrollFooter()
          Returns:
          The drawable that will be drawn below all other list content
        • 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 AbsListView
          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.
        • onFinishInflate

          protected void onFinishInflate()
          Description copied from class: View
          Finalize inflating a view from XML. This is called as the last phase of inflation, after all child views have been added.

          Even if the subclass overrides onFinishInflate, they should always be sure to call the super method, so that we get called.

          Overrides:
          onFinishInflate in class View
        • findViewTraversal

          protected View findViewTraversal(int id)
          Description copied from class: ViewGroup
          Overrides:
          findViewTraversal in class ViewGroup
          Parameters:
          id - the id of the view to be found
          Returns:
          the view of the specified id, null if cannot be found
        • findViewWithTagTraversal

          protected View findViewWithTagTraversal(Object tag)
          Description copied from class: ViewGroup
          Overrides:
          findViewWithTagTraversal in class ViewGroup
          Parameters:
          tag - the tag of the view to be found
          Returns:
          the view of specified tag, null if cannot be found


    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: 3335 / . Delta: 0.07914 с