java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | com.htc.widget.HtcAdapterView<T extends android.widget.Adapter> | |||
↳ | com.htc.widget.HtcAbsListView |
![]() |
Base class that can be used to implement virtualized lists of items. A list does not have a spatial definition here. For instance, subclases of this class can display the content of the list in a grid, in a carousel, as stack, etc.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
HtcAbsListView.AddAnimationListener | The callbacks to be invoked when delete animation starts or ends. | ||||||||||
HtcAbsListView.DeleteAnimationListener | The callbacks to be invoked when add animation starts or ends. | ||||||||||
HtcAbsListView.IntroAnimationListener | The callbacks to be invoked when intro animation starts or ends. | ||||||||||
HtcAbsListView.LayoutParams | AbsListView extends LayoutParams to provide a place to hold the view type. | ||||||||||
HtcAbsListView.MultiChoiceModeListener | A MultiChoiceModeListener receives events for HtcAbsListView#CHOICE_MODE_MULTIPLE_MODAL. | ||||||||||
HtcAbsListView.OnScrollListener | Interface definition for a callback to be invoked when the list or grid has been scrolled. | ||||||||||
HtcAbsListView.RecyclerListener | A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin's scrap heap. | ||||||||||
HtcAbsListView.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. | ||||||||||
HtcAbsListView.scrollToAddedPositionListener | The callbacks to be invoked smoothScroll end. |
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
android:cacheColorHint | Indicates that this list will always be drawn on top of solid, single-color opaque background. | ||||||||||
android:choiceMode | Defines the choice behavior for the view. | ||||||||||
android:drawSelectorOnTop | setDrawSelectorOnTop(boolean) | When set to true, the selector will be drawn over the selected item. | |||||||||
android:fastScrollEnabled | Enables the fast scroll thumb that can be dragged to quickly scroll through the list. | ||||||||||
android:listSelector | setSelector(int) | Drawable used to indicate the currently selected item in the list. | |||||||||
android:scrollingCache | When set to true, the list uses a drawing cache during scrolling. | ||||||||||
android:smoothScrollbar | setSmoothScrollbarEnabled(boolean) | When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. | |||||||||
android:stackFromBottom | Used by ListView and GridView to stack their content from the bottom. | ||||||||||
android:textFilterEnabled | When set to true, the list will filter results as the user types. | ||||||||||
android:transcriptMode | Sets the transcript mode for the list. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ANIM_ADD | ||||||||||
int | ANIM_CLICK | ||||||||||
int | ANIM_DEL | ||||||||||
int | ANIM_INTRO | ||||||||||
int | ANIM_OVERSCROLL | ||||||||||
int | CHOICE_MODE_MULTIPLE | The list allows multiple choices | |||||||||
int | CHOICE_MODE_NONE | Normal list that does not indicate choices | |||||||||
int | CHOICE_MODE_SINGLE | The list allows up to one choice | |||||||||
int | TRANSCRIPT_MODE_ALWAYS_SCROLL | The list will automatically scroll to the bottom, no matter what items are currently visible. | |||||||||
int | TRANSCRIPT_MODE_DISABLED | Disables the transcript mode. | |||||||||
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. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
mSelectionMethod |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clears any choices previously set
| |||||||||||
Clears the text filter.
| |||||||||||
Enables or disables one kind of animation;
default : enable all animations
HtcAbsListView.ANIM_OVERSCROLL, ANIM_INTRO, ANIM_CLICK, ANIM_ADD, ANIM_DEL;
can use bit operation, e.g.: ANIM_OVERSCROLL & ANIM_INTRO
| |||||||||||
Returns the number of items currently selected.
| |||||||||||
Returns the currently checked item.
| |||||||||||
Returns the set of checked items in the list.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
Returns the current transcript mode.
| |||||||||||
Causes all the views to be rebuilt and redrawn.
| |||||||||||
Returns the current state of the fast scroll feature.
| |||||||||||
Returns the checked state of the specified position.
| |||||||||||
For our text watcher that is associated with the text filter.
| |||||||||||
Maps a point to a position in the list.
| |||||||||||
Registers the add animation listener
| |||||||||||
Sets bottom border height of listview.
| |||||||||||
Sets Drawable of bottom divider.
| |||||||||||
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.
| |||||||||||
Defines the choice behavior for the List.
| |||||||||||
Registers the delete animation listener
| |||||||||||
Controls whether the selection highlight drawable should be drawn on top of the item or
behind it.
| |||||||||||
Enables fast scrolling by letting the user quickly scroll through lists by
dragging the fast scroll thumb.
| |||||||||||
Registers the intro animation listener
| |||||||||||
Sets the checked state of the specified position.
| |||||||||||
Sets the listener that will receive notifications every time the list scrolls.
| |||||||||||
Sets the recycler listener to be notified whenever a View is set aside in
the recycler for later reuse.
| |||||||||||
Registers the smooth scroll listener for add animation
| |||||||||||
Enables or disables the children's drawing cache during a scroll.
| |||||||||||
Sets a Drawable that should be used to highlight the currently selected item.
| |||||||||||
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.
| |||||||||||
Enables or disables the type filter window.
| |||||||||||
Sets top border height of listview.
| |||||||||||
Puts the list or grid into transcript mode.
| |||||||||||
Smoothly scrolls by distance pixels over duration milliseconds.
| |||||||||||
Smoothly scrolls to the specified adapter position.
| |||||||||||
Plays the intro animation
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Performs the fling action with the velocity initialVelocity
| |||||||||||
Subclasses should NOT override this method but
#layoutChildren() instead.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Indicates that this list will always be drawn on top of solid, single-color opaque background. This allows the list to optimize drawing.
Must be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol cacheColorHint
.
Defines the choice behavior for the view. By default, lists do not have
any choice behavior. By setting the choiceMode to singleChoice, the list
allows up to one item to be in a chosen state. By setting the choiceMode to
multipleChoice, the list allows any number of items to be chosen.
Finally, by setting the choiceMode to multipleChoiceModal the list allows
any number of items to be chosen in a special selection mode.
The application will supply a
android.widget.AbsListView.MultiChoiceModeListener using
setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener)
to control the
selection mode. This uses the android.view.ActionMode API.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
none | 0 | Normal list that does not indicate choices. |
singleChoice | 1 | The list allows up to one choice. |
multipleChoice | 2 | The list allows multiple choices. |
multipleChoiceModal | 3 | The list allows multiple choices in a custom selection mode. |
This corresponds to the global attribute resource symbol choiceMode
.
When set to true, the selector will be drawn over the selected item. Otherwise the selector is drawn behind the selected item. The default value is false.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol drawSelectorOnTop
.
Enables the fast scroll thumb that can be dragged to quickly scroll through the list.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol fastScrollEnabled
.
Drawable used to indicate the currently selected item in the list.
May be a reference to another resource, in the form "@[+][package:]type:name
"
or to a theme attribute in the form "?[package:][type:]name
".
May be a color value, in the form of "#rgb
", "#argb
",
"#rrggbb
", or "#aarrggbb
".
This corresponds to the global attribute resource symbol listSelector
.
When set to true, the list uses a drawing cache during scrolling. This makes the rendering faster but uses more memory. The default value is true.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol scrollingCache
.
When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. This property is set to true by default but should be set to false if your adapter will display items of varying heights. When this property is set to true and your adapter displays items of varying heights, the scrollbar thumb will change size as the user scrolls through the list. When set to fale, the list will use only the number of items in the adapter and the number of items visible on screen to determine the scrollbar's properties.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol smoothScrollbar
.
Used by ListView and GridView to stack their content from the bottom.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol stackFromBottom
.
When set to true, the list will filter results as the user types. The List's adapter must support the Filterable interface for this to work.
Must be a boolean value, either "true
" or "false
".
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute resource symbol textFilterEnabled
.
Sets the transcript mode for the list. In transcript mode, the list scrolls to the bottom to make new items visible when they are added.
Must be one of the following constant values.
Constant | Value | Description |
---|---|---|
disabled | 0 | Disables transcript mode. This is the default value. |
normal | 1 | 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. |
alwaysScroll | 2 | The list will automatically scroll to the bottom, no matter what items are currently visible. |
This corresponds to the global attribute resource symbol transcriptMode
.
The list allows multiple choices
Normal list that does not indicate choices
The list allows up to one choice
The list will automatically scroll to the bottom, no matter what items are currently visible.
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.
Enables or disables one kind of animation; default : enable all animations HtcAbsListView.ANIM_OVERSCROLL, ANIM_INTRO, ANIM_CLICK, ANIM_ADD, ANIM_DEL; can use bit operation, e.g.: ANIM_OVERSCROLL & ANIM_INTRO
anim_id | HtcAbsListView.ANIM_OVERSCROLL, ANIM_INTRO, ANIM_CLICK, ANIM_ADD, ANIM_DEL; |
---|---|
enable | true or false |
Returns the number of items currently selected. This will only be valid
if the choice mode is not CHOICE_MODE_NONE
(default).
To determine the specific items that are currently selected, use one of
the getChecked*
methods.
getCheckedItemPosition()
getCheckedItemPositions()
Returns the currently checked item. The result is only valid if the choice
mode has been set to CHOICE_MODE_SINGLE
.
INVALID_POSITION
if nothing is selectedReturns 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
.
null
if the choice mode is set to
CHOICE_MODE_NONE
.
List padding is the maximum of the normal view's padding and the padding of the selector.
getPaddingBottom()
List padding is the maximum of the normal view's padding and the padding of the selector.
getPaddingTop()
Returns the current state of the fast scroll feature.
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
.
position | The item whose checked state to return |
---|
false
if choice mode
is invalidFor 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.
Maps a point to a position in the list.
x | X in local coordinate |
---|---|
y | Y in local coordinate |
INVALID_POSITION
if the point does not intersect an item.
Registers the add animation listener
Sets bottom border height of listview.
height | Height of bottom border. |
---|
Sets Drawable of bottom divider.
dr | Drawable to be drawn for bottom divider. |
---|
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 setBackgroundDrawable(Drawable)
).
color | The background color |
---|
Defines the choice behavior for the List. By default, Lists do not have any choice behavior
(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
|
---|
Registers the delete animation listener
Controls whether the selection highlight drawable should be drawn on top of the item or behind it.
onTop | If true, the selector will be drawn on the item it is highlighting. The default is false. |
---|
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.
enabled | Whether or not to enable fast scrolling |
---|
Registers the intro animation listener
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
.
position | The item whose checked state is to be checked |
---|---|
value | The new checked state for the item |
Sets the listener that will receive notifications every time the list scrolls.
l | The scroll 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.
listener | The recycler listener to be notified of views set aside in the recycler. |
---|
AbsListView.RecyclerListener
Registers the smooth scroll listener for add animation
Enables or disables the children's drawing cache during a scroll.
By default, the drawing cache is enabled but this will use more memory.
When the scrolling cache is enabled, the caches are kept after the
first scrolling. You can manually clear the cache by calling
setChildrenDrawingCacheEnabled(boolean)
.
enabled | true to enable the scroll cache, false otherwise |
---|
setDrawingCacheEnabled(boolean)
Sets a Drawable that should be used to highlight the currently selected item.
resID | A Drawable resource to use as the selection highlight. |
---|
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.
enabled | Whether or not to enable smooth scrollbar. |
---|
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.
textFilterEnabled | true to enable type filtering, false otherwise |
---|
Sets top border height of listview.
height | Sets height of top border. |
---|
Puts the list or grid into transcript mode. In this mode the list or grid will always scroll to the bottom to show new items.
mode | The transcript mode to set |
---|
Smoothly scrolls by distance pixels over duration milliseconds.
distance | Distance to scroll in pixels. |
---|---|
duration | Duration of the scroll animation in milliseconds. |
Smoothly scrolls 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.
position | Position to scroll to |
---|---|
offset | Desired distance in pixels of position from the top
of the view when scrolling is finished
|
Performs the fling action with the velocity initialVelocity
initialVelocity | The fling velocity |
---|
Subclasses should NOT override this method but #layoutChildren() instead.