Android7.0中文API -- ListView

来源:互联网 发布:用户管理系统java 编辑:程序博客网 时间:2024/05/17 22:57

完整内容http://www.zhdoc.net/android/reference/android/widget/ListView.html


ListView

public class ListView
extendsAbsListView

java.lang.Object   ↳android.view.View    ↳android.view.ViewGroup     ↳android.widget.AdapterView<android.widget.ListAdapter>      ↳android.widget.AbsListView       ↳android.widget.ListView
已知的直接子类


A view that shows items in a vertically scrolling list. The items come from theListAdapter associated with this view.
一个视图,其在垂直滚动的列表中显示项。这些项来自与此视图关联的ListAdapter

See the List View guide.
请参考List View。

摘要


嵌套类

classListView.FixedViewInfo

A class that represents a fixed view in a list, for example a header at the top or a footer at the bottom. 
表现列表中一个固定的视图的类,例如顶部的页眉或者底部的页脚。 

XML属性

android:divider在列表项之间绘制的drawable或color。 android:divider在列表项之间绘制的drawable或color。 android:dividerHeight分隔栏的高度。 android:entries对ListView的填充数组资源的引用。 android:footerDividersEnabled设置为false时,ListView不会在每个footer view之前绘制分隔栏。 android:headerDividersEnabled设置为false时,ListView不会在每个头部标题视图之前绘制分隔栏。 

继承XML属性

From class android.widget.AbsListView
From class android.view.ViewGroup
From class android.view.View

继承常量

From class android.widget.AbsListView
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View

继承字段

From class android.view.View

Public构造方法

ListView(Context context) ListView(Context context, AttributeSet attrs) ListView(Context context, AttributeSet attrs, int defStyleAttr) ListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public方法

voidaddFooterView(View v, Object data, boolean isSelectable)

Add a fixed view to appear at the bottom of the list.
在列表的底部添加一个固定的视图。

voidaddFooterView(View v)

Add a fixed view to appear at the bottom of the list.
在列表的底部添加一个固定的视图。

voidaddHeaderView(View v, Object data, boolean isSelectable)

Add a fixed view to appear at the top of the list.
在列表的顶部添加一个固定的视图。

voidaddHeaderView(View v)

Add a fixed view to appear at the top of the list.
在列表的顶部添加一个固定的视图。

booleanareFooterDividersEnabled()booleanareHeaderDividersEnabled()booleandispatchKeyEvent(KeyEvent event)

Dispatch a key event to the next view on the focus path.
向焦点路径上的下一个视图派发一个KeyEvent。

CharSequencegetAccessibilityClassName()

Return the class name of this object to be used for accessibility purposes.
返回此对象的类名,用于辅助功能目的。

ListAdaptergetAdapter()

Returns the adapter currently in use in this ListView.
返回此ListView中当前使用的适配器。

long[]getCheckItemIds()

This method was deprecated in API level 8. Use getCheckedItemIds() instead.
此方法在API level 8版本中被删除。用getCheckedItemIds()来代替。

DrawablegetDivider()

Returns the drawable that will be drawn between each item in the list.
返回drawable,其在列表中每一项之间绘制。

intgetDividerHeight()intgetFooterViewsCount()

Returns the number of footer views in the list.
返回列表中页脚视图的数量。

intgetHeaderViewsCount()

Returns the number of header views in the list.
返回列表中页眉视图的数量。

booleangetItemsCanFocus()intgetMaxScrollAmount()DrawablegetOverscrollFooter()DrawablegetOverscrollHeader()booleanisOpaque()

Indicates whether this View is opaque.
此视图是否不透明。

voidonInitializeAccessibilityNodeInfoForItem(View view, int position, AccessibilityNodeInfo info)

Initializes an AccessibilityNodeInfo with information about a particular item in the list.
在列表中初始化一个AccessibilityNodeInfo,其与特定项的信息有关。

booleanonKeyDown(int keyCode,KeyEvent event)

Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view whenKEYCODE_DPAD_CENTER orKEYCODE_ENTER is released, if the view is enabled and clickable.
KeyEvent.Callback.onKeyDown()的默认实现;如果view是使能的并且可点击,则当KEYCODE_DPAD_CENTERKEYCODE_ENTER释放后,执行此视图的按键按下事件。

booleanonKeyMultiple(int keyCode, int repeatCount,KeyEvent event)

Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).
KeyEvent.Callback.onKeyMultiple()的默认实现;如果不处理事件,则始终返回false。

booleanonKeyUp(int keyCode,KeyEvent event)

Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view whenKEYCODE_DPAD_CENTER,KEYCODE_ENTER orKEYCODE_SPACE is released.
KeyEvent.Callback.onKeyUp()的默认实现;当KEYCODE_DPAD_CENTERKEYCODE_ENTERKEYCODE_SPACE释放后,执行此视图的点击事件。

booleanremoveFooterView(View v)

Removes a previously-added footer view.
删除之前添加的页脚视图。

booleanremoveHeaderView(View v)

Removes a previously-added header view.
删除之前添加的页眉视图。

booleanrequestChildRectangleOnScreen(View child, Rect rect, boolean immediate)

Called when a child of this group wants a particular rectangle to be positioned onto the screen.
当此组的子项希望将特定的矩形置于屏幕上时调用。

voidsetAdapter(ListAdapter adapter)

Sets the data behind this ListView.
设置绑定此ListView的数据。

voidsetCacheColorHint(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.
当设置为非零值时,缓存颜色Hint表示该列表总是在一个纯色、单色、不透明的背景之上绘制。

voidsetDivider(Drawable divider)

Sets the drawable that will be drawn between each item in the list.
设置drawable,其在列表中每一项之间绘制。

voidsetDividerHeight(int height)

Sets the height of the divider that will be drawn between each item in the list.
设置分割栏的高度,其在列表中每一项之间绘制。

voidsetFooterDividersEnabled(boolean footerDividersEnabled)

Enables or disables the drawing of the divider for footer views.
使能或禁用为页脚视图绘制分割栏。

voidsetHeaderDividersEnabled(boolean headerDividersEnabled)

Enables or disables the drawing of the divider for header views.
使能或禁用为页眉视图绘制分割栏。

voidsetItemsCanFocus(boolean itemsCanFocus)

Indicates that the views created by the ListAdapter can contain focusable items.
设置由ListAdapter创建的石头可以包含能获取焦点的项。

voidsetOverscrollFooter(Drawable footer)

Sets the drawable that will be drawn below all other list content.
设置drawable,其绘制在所有其他列表内容下面。

voidsetOverscrollHeader(Drawable header)

Sets the drawable that will be drawn above all other list content.
设置drawable,其绘制在所有其他列表内容上面。

voidsetRemoteViewsAdapter(Intent intent)

Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService through the specified intent.
设置此AbsListView作为一个远程视图适配器使用,其通过指定的intent连接到RemoteViewsService。

voidsetSelection(int position)

Sets the currently selected item.
设置当前已选择的项。

voidsetSelectionAfterHeaderView()

setSelectionAfterHeaderView set the selection to be the first list item after the header views.
setSelectionAfterHeaderView方法将设置选择为页面视图之后的第一个列表项。

voidsmoothScrollByOffset(int offset)

Smoothly scroll to the specified adapter position offset.
流畅地滚动到指定的适配器的位置偏移。

voidsmoothScrollToPosition(int position)

Smoothly scroll to the specified adapter position.
流畅地滚动到指定的适配器的位置。

保护方法


完整内容http://www.zhdoc.net/android/reference/android/widget/ListView.html

原创粉丝点击