Most visited

Recently visited

Added in API level 1

AbsListView

public abstract class AbsListView
extends AdapterView<ListAdapter> implements TextWatcher, ViewTreeObserver.OnGlobalLayoutListener, Filter.FilterListener, ViewTreeObserver.OnTouchModeChangeListener

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.AdapterView<android.widget.ListAdapter>
         ↳ android.widget.AbsListView
Known Direct Subclasses
Known Indirect Subclasses


可用于实现项目虚拟化列表的基类。 列表在这里没有空间定义。 例如,这个类的子类可以在网格中,在轮播中,作为堆栈等显示列表的内容。

Summary

Nested classes

class AbsListView.LayoutParams

AbsListView扩展了LayoutParams以提供一个位置来保存视图类型。

interface AbsListView.MultiChoiceModeListener

一个MultiChoiceModeListener接收事件CHOICE_MODE_MULTIPLE_MODAL

interface AbsListView.OnScrollListener

滚动列表或网格时要调用的回调的接口定义。

interface AbsListView.RecyclerListener

RecyclerListener用于在View中放入RecycleBin的废料堆内时接收通知。

interface AbsListView.SelectionBoundsAdjuster

列表项的顶层视图可以实现此接口,以允许自己修改为该项显示的选择范围。

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 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 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 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. 

Inherited XML attributes

From class android.view.ViewGroup
From class android.view.View

Constants

int CHOICE_MODE_MULTIPLE

该列表允许多种选择

int CHOICE_MODE_MULTIPLE_MODAL

该列表允许在模态选择模式下进行多种选择

int CHOICE_MODE_NONE

正常列表,不表示选择

int CHOICE_MODE_SINGLE

该列表允许最多一个选择

int TRANSCRIPT_MODE_ALWAYS_SCROLL

该列表将自动滚动到底部,无论当前哪些项目可见。

int TRANSCRIPT_MODE_DISABLED

禁用转录模式。

int TRANSCRIPT_MODE_NORMAL

收到数据集更改通知后,列表将自动滚动到底部,并且只有最后一个项目在屏幕上可见时才会滚动到底部。

Inherited constants

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

Inherited fields

From class android.view.View

Public constructors

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

Public methods

void addTouchables(ArrayList<View> views)

添加这个视图的后代的任何可触摸的视图(如果它可以自己触摸,可能包括这个视图)到视图。

void afterTextChanged(Editable s)

对于与文本过滤器关联的文本观察器。

void beforeTextChanged(CharSequence s, int start, int count, int after)

对于与文本过滤器关联的文本观察器。

boolean canScrollList(int direction)

检查列表中的项目是否可以在某个方向滚动。

boolean checkInputConnectionProxy(View view)

为了过滤,我们将一个输入连接代理给一个内部文本编辑器,这就允许代理发生。

void clearChoices()

清除以前设置的任何选项

void clearTextFilter()

清除文本过滤器。

void deferNotifyDataSetChanged()

如果它尚未连接,则推迟挂起的RemoteViewsAdapter上的notifyDataSetChanged。

void dispatchDrawableHotspotChanged(float x, float y)

将可绘制的热点更改分派到满足以下至少一个条件的子视图:

void draw(Canvas canvas)

手动将此视图(及其所有子项)呈现给定的Canvas。

void fling(int velocityY)

以给定速度开始投掷。

AbsListView.LayoutParams generateLayoutParams(AttributeSet attrs)

根据提供的属性集返回一组新的布局参数。

CharSequence getAccessibilityClassName()

返回此对象的类名称以用于辅助功能。

int getCacheColorHint()

设置为非零值时,缓存颜色提示表明此列表总是绘制在纯色,单色,不透明背景之上

int getCheckedItemCount()

返回当前选定的项目数量。

long[] getCheckedItemIds()

返回检查项目标识的集合。

int getCheckedItemPosition()

返回当前选中的项目。

SparseBooleanArray getCheckedItemPositions()

返回列表中选中的项目集。

int getChoiceMode()
void getFocusedRect(Rect r)

当视图具有焦点并且用户离开它时,从该方法填充的矩形开始搜索下一个视图。

int getListPaddingBottom()

列表填充是普通视图的填充和选择器的填充的最大值。

int getListPaddingLeft()

列表填充是普通视图的填充和选择器的填充的最大值。

int getListPaddingRight()

列表填充是普通视图的填充和选择器的填充的最大值。

int getListPaddingTop()

列表填充是普通视图的填充和选择器的填充的最大值。

View getSelectedView()
Drawable getSelector()

返回用于在列表中绘制选择的选择器 Drawable

int getSolidColor()

如果已知视图始终在纯色背景上绘制,并需要绘制渐变边缘,则覆盖此视图。

CharSequence getTextFilter()

返回列表的文本过滤器(如果可用)。

int getTranscriptMode()

返回当前转录模式。

int getVerticalScrollbarWidth()

返回垂直滚动条的宽度。

boolean hasTextFilter()

如果ListView当前具有文本过滤器,则返回。

void invalidateViews()

导致所有视图被重建和重绘。

boolean isFastScrollAlwaysVisible()

如果快速滚动条始终显示在此视图上,则返回true。

boolean isFastScrollEnabled()

如果启用快速滚动条,则返回true。

boolean isItemChecked(int position)

返回指定位置的选中状态。

boolean isScrollingCacheEnabled()

指示在滚动过程中是否使用儿童绘画缓存。

boolean isSmoothScrollbarEnabled()

返回快速滚动功能的当前状态。

boolean isStackFromBottom()

指示此视图的内容是固定到底部边缘还是从底部边缘堆叠。

boolean isTextFilterEnabled()

指示是否为此视图启用类型筛选

void jumpDrawablesToCurrentState()

在与此视图关联的所有可绘制对象上调用 Drawable.jumpToCurrentState()

void onCancelPendingInputEvents()

在此视图或父视图上调用 cancelPendingInputEvents()的结果。

InputConnection onCreateInputConnection(EditorInfo outAttrs)

返回InputConnection以编辑过滤器文本。

void onFilterComplete(int count)

通知过滤操作结束。

boolean onGenericMotionEvent(MotionEvent event)

实现此方法来处理通用运动事件。

void onGlobalLayout()

当全局布局状态或视图树中视图的可见性发生更改时调用回调方法

void onInitializeAccessibilityNodeInfoForItem(View view, int position, AccessibilityNodeInfo info)

使用有关列表中特定项目的信息初始化 AccessibilityNodeInfo

boolean onInterceptHoverEvent(MotionEvent event)

实现此方法以在由子视图处理悬停事件之前拦截悬停事件。

boolean onInterceptTouchEvent(MotionEvent ev)

实施此方法来拦截所有触摸屏幕动作事件。

boolean onKeyDown(int keyCode, KeyEvent event)

KeyEvent.Callback.onKeyDown()默认实现:当 KEYCODE_DPAD_CENTERKEYCODE_ENTER被释放时,如果视图被启用并且可点击,则执行按下视图。

boolean onKeyUp(int keyCode, KeyEvent event)

的默认实现 KeyEvent.Callback.onKeyUp() :当视图进行点击 KEYCODE_DPAD_CENTERKEYCODE_ENTER或者 KEYCODE_SPACE被释放。

boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed)

从嵌套滚动中请求投掷。

void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)

反应到正在进行的嵌套滚动。

void onNestedScrollAccepted(View child, View target, int axes)

响应成功声明嵌套滚动操作。

boolean onRemoteAdapterConnected()

当适配器连接到RemoteViewsService时调用回来。

void onRemoteAdapterDisconnected()

当适配器从RemoteViewsService断开连接时回调。

void onRestoreInstanceState(Parcelable state)

吊钩允许视图重新应用以前由 onSaveInstanceState()生成的内部状态的表示。

void onRtlPropertiesChanged(int layoutDirection)

当任何RTL属性(布局方向或文本方向或文本对齐)已被更改时调用。

Parcelable onSaveInstanceState()

钩子允许视图生成其内部状态的表示,稍后可用于创建具有相同状态的新实例。

boolean onStartNestedScroll(View child, View target, int nestedScrollAxes)

响应启动可嵌套滚动操作的后代视图,并在适当的情况下声明嵌套滚动操作。

void onTextChanged(CharSequence s, int start, int before, int count)

对于与文本过滤器关联的文本观察器。

boolean onTouchEvent(MotionEvent ev)

实现此方法来处理触摸屏幕动作事件。

void onTouchModeChanged(boolean isInTouchMode)

在触摸模式更改时要调用的回调方法。

void onWindowFocusChanged(boolean hasWindowFocus)

当包含此视图的窗口获得或失去焦点时调用。

boolean performItemClick(View view, int position, long id)

调用OnItemClickListener(如果已定义)。

int pointToPosition(int x, int y)

将点映射到列表中的某个位置。

long pointToRowId(int x, int y)

将点映射到与该点相交的项目的rowId。

void reclaimViews(List<View> views)

将此AbsListView保存的所有视图(不包括页眉和页脚)移动到提供的列表中。

void requestDisallowInterceptTouchEvent(boolean disallowIntercept)

当孩子不希望这个父母及其祖先用 onInterceptTouchEvent(MotionEvent)拦截触摸事件时 onInterceptTouchEvent(MotionEvent)

void requestLayout()

当事情发生变化时调用它,这已经使这个视图的布局无效。

void scrollListBy(int y)

将视图中的列表项目按指定的像素数滚动。

void setAdapter(ListAdapter adapter)

设置提供数据的适配器和视图来表示这个小部件中的数据。

void setCacheColorHint(int color)

当设置为非零值时,缓存颜色提示表明此列表总是绘制在纯色,单色,不透明背景的顶部。

void setChoiceMode(int choiceMode)

定义列表的选择行为。

void setDrawSelectorOnTop(boolean onTop)

控制是否应该在项目顶部或其后面绘制选择高亮可绘制选项。

void setFastScrollAlwaysVisible(boolean alwaysShow)

设置是否应始终显示快速滚动条而不是标准滚动条。

void setFastScrollEnabled(boolean enabled)

指定是否启用快速滚动。

void setFastScrollStyle(int styleResId)

指定快速滚动装饰的风格。

void setFilterText(String filterText)

设置文本过滤器的初始值。

void setFriction(float friction)

施加在fl上的摩擦量。

void setItemChecked(int position, boolean value)

设置指定位置的选中状态。

void setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener listener)

设置一个 AbsListView.MultiChoiceModeListener ,它将管理选择 ActionMode的生命周期。

void setOnScrollListener(AbsListView.OnScrollListener l)

设置每次列表滚动时都会收到通知的侦听器。

void setOverScrollMode(int mode)

为此视图设置过卷模式。

void setRecyclerListener(AbsListView.RecyclerListener listener)

设置回收站侦听器,只要在回收站中留出View以供日后重新使用时通知。

void setRemoteViewsAdapter(Intent intent)

设置此AbsListView以使用通过指定意图连接到RemoteViewsService的远程视图适配器。

void setScrollBarStyle(int style)

指定滚动条的样式。

void setScrollIndicators(View up, View down)
void setScrollingCacheEnabled(boolean enabled)

在滚动过程中启用或禁用儿童的绘图缓存。

void setSelectionFromTop(int position, int y)

设置选定的项目并将选择y像素从ListView的顶部边缘放置。

void setSelector(int resID)

设置应该用于突出显示当前选定项目的Drawable。

void setSelector(Drawable sel)
void setSmoothScrollbarEnabled(boolean enabled)

当启用平滑滚动条时,滚动条缩略图的位置和大小将根据可见项目中可见像素的数量进行计算。

void setStackFromBottom(boolean stackFromBottom)

当从底部开始堆栈设置为true时,列表将从视图底部开始填充其内容。

void setTextFilterEnabled(boolean textFilterEnabled)

启用或禁用类型筛选器窗口。

void setTranscriptMode(int mode)

将列表或网格放入记录模式。

void setVelocityScale(float scale)

设置闪光速度的比例因子。

void setVerticalScrollbarPosition(int position)

设置垂直滚动条的位置。

boolean showContextMenu(float x, float y)

显示锚定到指定视图相对坐标的此视图的上下文菜单。

boolean showContextMenu()

显示该视图的上下文菜单。

boolean showContextMenuForChild(View originalView, float x, float y)

显示指定视图或其祖先的上下文菜单,该上下文菜单被锚定到指定的视图相对坐标。

boolean showContextMenuForChild(View originalView)

显示指定视图或其祖先的上下文菜单。

void smoothScrollBy(int distance, int duration)

在持续时间毫秒内平滑滚动像素距离。

void smoothScrollToPosition(int position)

平滑地滚动到指定的适配器位置。

void smoothScrollToPosition(int position, int boundPosition)

平滑地滚动到指定的适配器位置。

void smoothScrollToPositionFromTop(int position, int offset, int duration)

平滑地滚动到指定的适配器位置。

void smoothScrollToPositionFromTop(int position, int offset)

平滑地滚动到指定的适配器位置。

boolean verifyDrawable(Drawable dr)

如果你的视图子类正在显示它自己的Drawable对象,它应该覆盖这个函数,并且对于它显示的任何Drawable返回true。

Protected methods

boolean checkLayoutParams(ViewGroup.LayoutParams p)
int computeVerticalScrollExtent()

计算垂直滚动条拇指在垂直范围内的垂直范围。

int computeVerticalScrollOffset()

计算垂直滚动条拇指在水平范围内的垂直偏移量。

int computeVerticalScrollRange()

计算垂直滚动条代表的垂直范围。

void dispatchDraw(Canvas canvas)

通过绘制来绘制子视图。

void dispatchSetPressed(boolean pressed)

派发setPressed给所有这个View的孩子。

void drawableStateChanged()

只要视图的状态发生变化,就会调用此函数,使得它影响所显示的可绘制状态。

ViewGroup.LayoutParams generateDefaultLayoutParams()

返回一组默认布局参数。

ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)

根据提供的布局参数返回一组安全的布局参数。

float getBottomFadingEdgeStrength()

返回底部渐变边的强度或强度。

int getBottomPaddingOffset()

扩展底部衰落区域的数量。

ContextMenu.ContextMenuInfo getContextMenuInfo()

视图应该实现这个,如果他们有额外的信息与上下文菜单相关联。

int getLeftPaddingOffset()

扩展左衰落区域的量。

int getRightPaddingOffset()

扩展正确衰落区域的数量。

float getTopFadingEdgeStrength()

返回顶部褪色边缘的强度或强度。

int getTopPaddingOffset()

扩大最大衰落区域的数量。

void handleDataChanged()
boolean isInFilterMode()

指示此视图是否处于过滤器模式。

boolean isPaddingOffsetRequired()

如果视图在其填充内绘制内容并启用淡化边缘,则需要支持填充偏移。

void layoutChildren()

子类必须重写此方法来布局他们的子项。

void onAttachedToWindow()

这在视图附加到窗口时被调用。

void onDetachedFromWindow()

这是在视图从窗口分离时调用的。

void onDisplayHint(int hint)

给出这个观点暗示是否显示。

void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)

当视图的焦点状态改变时,由视图系统调用。

void onLayout(boolean changed, int l, int t, int r, int b)

子类不应该重写此方法,而 layoutChildren()改为 layoutChildren()

void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

测量视图及其内容以确定测量宽度和测量高度。

void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY)

overScrollBy(int, int, int, int, int, int, int, int, boolean)调用以响应过度滚动操作的结果。

void onSizeChanged(int w, int h, int oldw, int oldh)

当这个视图的大小发生变化时,这在布局期间被调用。

Inherited methods

From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.text.TextWatcher
From interface android.view.ViewTreeObserver.OnGlobalLayoutListener
From interface android.widget.Filter.FilterListener
From interface android.view.ViewTreeObserver.OnTouchModeChangeListener

XML attributes

android:cacheColorHint

表示此列表将始终绘制在纯色,单色不透明背景之上。 这允许列表优化绘图。

必须是“ #rgb ”,“ #argb ”,“ #rrggbb ”或“ #aarrggbb ”形式的颜色值。

这也可能是对包含此类型值的资源(形式为“ @[package:]type:name ”)或主题属性(形式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 cacheColorHint

android:choiceMode

定义视图的选择行为。 默认情况下,列表没有任何选择行为。 通过将choiceMode设置为singleChoice,该列表最多允许一个项目处于选定状态。 通过将choiceMode设置为multipleChoice,该列表允许选择任意数量的项目。 最后,通过将choiceMode设置为multipleChoiceModal,该列表允许在特殊选择模式下选择任意数量的项目。 该应用程序将提供一个AbsListView.MultiChoiceModeListener使用setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener)来控制选择模式。 这使用ActionMode API。

必须是下列常数值之一。

Constant Value 描述
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.

这对应于全局属性资源符号 choiceMode

android:drawSelectorOnTop

设置为true时,选择器将被绘制在选定的项目上。 否则,选择器将被绘制在所选项目的后面。 默认值是false。

必须是布尔值,可以是“ true ”或“ false ”。

这也可能是对包含此类型值的资源(形式为“ @[package:]type:name ”)或主题属性(形式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 drawSelectorOnTop

相关方法:

android:fastScrollEnabled

启用可拖动的快速滚动快速键以快速滚动列表。

必须是布尔值,“ true ”或“ false ”。

这也可能是对包含此类型值的资源(格式为“ @[package:]type:name ”)或主题属性(格式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 fastScrollEnabled

android:listSelector

可绘制用于指示列表中当前选定的项目。

可能是另一种资源的引用,其形式为“ @[+][package:]type:name ”,或者其形式为“一个主题属性 ?[package:][type:]name ”。

可能是颜色值,格式为“ #rgb ”,“ #argb ”,“ #rrggbb ”或“ #aarrggbb ”。

这对应于全局属性资源符号 listSelector

相关方法:

android:scrollingCache

设置为true时,列表在滚动期间使用图形缓存。 这使渲染更快,但使用更多的内存。 默认值是true。

必须是布尔值,可以是“ true ”或“ false ”。

这也可能是对包含此类型值的资源(形式为“ @[package:]type:name ”)或主题属性(形式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 scrollingCache

android:smoothScrollbar

设置为true时,列表将使用基于屏幕上可见项目像素高度的更精确的计算方法。 该属性默认设置为true,但如果您的适配器将显示不同高度的项目,则该属性应设置为false。 当此属性设置为true并且您的适配器显示不同高度的项目时,滚动条的大拇指会随着用户滚动列表而改变大小。 当设置为false时,列表将只使用适配器中的项目数量和屏幕上可见的项目数量来确定滚动条的属性。

必须是布尔值,“ true ”或“ false ”。

这也可能是对包含此类型值的资源(格式为“ @[package:]type:name ”)或主题属性(格式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 smoothScrollbar

相关方法:

android:stackFromBottom

由ListView和GridView用来从底部堆叠它们的内容。

必须是布尔值,可以是“ true ”或“ false ”。

这也可能是对包含此类型值的资源(形式为“ @[package:]type:name ”)或主题属性(形式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 stackFromBottom

android:textFilterEnabled

设置为true时,该列表将在用户输入时过滤结果。 列表的适配器必须支持Filterable接口才能工作。

必须是布尔值,可以是“ true ”或“ false ”。

这也可能是对包含此类型值的资源(形式为“ @[package:]type:name ”)或主题属性(形式为“ ?[package:][type:]name ”)的 ?[package:][type:]name

这对应于全局属性资源符号 textFilterEnabled

android:transcriptMode

设置列表的转录模式。 在记录模式下,列表滚动到底部,以便在添加新项目时可见。

必须是下列常数值之一。

Constant Value 描述
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.

这对应于全局属性资源符号 transcriptMode

Constants

CHOICE_MODE_MULTIPLE

Added in API level 1
int CHOICE_MODE_MULTIPLE

该列表允许多种选择

常量值:2(0x00000002)

CHOICE_MODE_MULTIPLE_MODAL

Added in API level 11
int CHOICE_MODE_MULTIPLE_MODAL

该列表允许在模态选择模式下进行多种选择

常量值:3(0x00000003)

CHOICE_MODE_NONE

Added in API level 1
int CHOICE_MODE_NONE

正常列表,不表示选择

常量值:0(0x00000000)

CHOICE_MODE_SINGLE

Added in API level 1
int CHOICE_MODE_SINGLE

该列表允许最多一个选择

常数值:1(0x00000001)

TRANSCRIPT_MODE_ALWAYS_SCROLL

Added in API level 1
int TRANSCRIPT_MODE_ALWAYS_SCROLL

该列表将自动滚动到底部,无论当前哪些项目可见。

也可以看看:

常量值:2(0x00000002)

TRANSCRIPT_MODE_DISABLED

Added in API level 1
int TRANSCRIPT_MODE_DISABLED

禁用转录模式。

也可以看看:

常量值:0(0x00000000)

TRANSCRIPT_MODE_NORMAL

Added in API level 1
int TRANSCRIPT_MODE_NORMAL

收到数据集更改通知后,列表将自动滚动到底部,并且只有最后一个项目在屏幕上可见时才会滚动到底部。

也可以看看:

常数值:1(0x00000001)

Public constructors

AbsListView

Added in API level 1
AbsListView (Context context)

Parameters
context Context

AbsListView

Added in API level 1
AbsListView (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

AbsListView

Added in API level 1
AbsListView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

AbsListView

Added in API level 21
AbsListView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context
attrs AttributeSet
defStyleAttr int
defStyleRes int

Public methods

addTouchables

Added in API level 1
void addTouchables (ArrayList<View> views)

添加这个视图的后代的任何可触摸的视图(如果它可以自己触摸,可能包括这个视图)到视图。

Parameters
views ArrayList: Touchable views found so far

afterTextChanged

Added in API level 1
void afterTextChanged (Editable s)

对于与文本过滤器关联的文本观察器。 什么也没做。

Parameters
s Editable

beforeTextChanged

Added in API level 1
void beforeTextChanged (CharSequence s, 
                int start, 
                int count, 
                int after)

对于与文本过滤器关联的文本观察器。 什么也没做。

Parameters
s CharSequence
start int
count int
after int

canScrollList

Added in API level 19
boolean canScrollList (int direction)

检查列表中的项目是否可以在某个方向滚动。

Parameters
direction int: Negative to check scrolling up, positive to check scrolling down.
Returns
boolean true if the list can be scrolled in the specified direction, false otherwise.

也可以看看:

checkInputConnectionProxy

Added in API level 3
boolean checkInputConnectionProxy (View view)

为了过滤,我们将一个输入连接代理给一个内部文本编辑器,这就允许代理发生。

Parameters
view View: The View that is making the InputMethodManager call.
Returns
boolean Return true to allow the call, false to reject.

clearChoices

Added in API level 1
void clearChoices ()

清除以前设置的任何选项

clearTextFilter

Added in API level 1
void clearTextFilter ()

清除文本过滤器。

deferNotifyDataSetChanged

Added in API level 14
void deferNotifyDataSetChanged ()

如果它尚未连接,则推迟挂起的RemoteViewsAdapter上的notifyDataSetChanged。

dispatchDrawableHotspotChanged

Added in API level 22
void dispatchDrawableHotspotChanged (float x, 
                float y)

将可绘制的热点更改分派到满足以下至少一个条件的子视图:

Parameters
x float: hotspot x coordinate
y float: hotspot y coordinate

draw

Added in API level 1
void draw (Canvas canvas)

手动将此视图(及其所有子项)呈现给定的Canvas。 在调用这个函数之前,视图必须已经完成了一个完整的布局。 在实现视图时,实现onDraw(android.graphics.Canvas)而不是重写此方法。 如果您确实需要重写此方法,请调用超类版本。

Parameters
canvas Canvas: The Canvas to which the View is rendered.

fling

Added in API level 21
void fling (int velocityY)

以给定速度开始投掷。

应用程序可以使用此方法手动启动投掷,就好像用户通过触摸交互启动投掷一样。

Parameters
velocityY int: Vertical velocity in pixels per second. Note that this is velocity of content, not velocity of a touch that initiated the fling.

generateLayoutParams

Added in API level 1
AbsListView.LayoutParams generateLayoutParams (AttributeSet attrs)

根据提供的属性集返回一组新的布局参数。

Parameters
attrs AttributeSet: the attributes to build the layout parameters from
Returns
AbsListView.LayoutParams an instance of ViewGroup.LayoutParams or one of its descendants

getAccessibilityClassName

Added in API level 23
CharSequence getAccessibilityClassName ()

返回此对象的类名称以用于辅助功能。 如果子类正在实现的东西应该被视为一个全新的视图类,当它被可访问性使用时,子类只应该覆盖这个子类,与它所源自的类无关。 这用于填写AccessibilityNodeInfo.setClassName

Returns
CharSequence

getCacheColorHint

Added in API level 1
int getCacheColorHint ()

设置为非零值时,缓存颜色提示表明此列表总是绘制在纯色,单色,不透明背景之上

Returns
int The cache color hint

getCheckedItemCount

Added in API level 11
int getCheckedItemCount ()

返回当前选定的项目数量。 这只有在选择模式不是CHOICE_MODE_NONE (默认)时才有效。

要确定当前选择的特定项目,请使用 getChecked*方法之一。

Returns
int The number of items currently selected

也可以看看:

getCheckedItemIds

Added in API level 8
long[] getCheckedItemIds ()

返回检查项目标识的集合。 结果仅在选择模式未设置为CHOICE_MODE_NONE且适配器具有稳定ID时才有效。 hasStableIds() == true

Returns
long[] A new array which contains the id of each checked item in the list.

getCheckedItemPosition

Added in API level 1
int getCheckedItemPosition ()

返回当前选中的项目。 结果仅在选择模式设置为CHOICE_MODE_SINGLE

Returns
int The position of the currently checked item or INVALID_POSITION if nothing is selected

也可以看看:

getCheckedItemPositions

Added in API level 1
SparseBooleanArray getCheckedItemPositions ()

返回列表中选中的项目集。 结果仅在选择模式未设置为CHOICE_MODE_NONE

Returns
SparseBooleanArray A SparseBooleanArray which will return true for each call to get(int position) where position is a checked position in the list and false otherwise, or null if the choice mode is set to CHOICE_MODE_NONE.

getChoiceMode

Added in API level 1
int getChoiceMode ()

Returns
int The current choice mode

也可以看看:

getFocusedRect

Added in API level 1
void getFocusedRect (Rect r)

当视图具有焦点并且用户离开它时,从该方法填充的矩形开始搜索下一个视图。 默认情况下,该矩形是视图的getDrawingRect(android.graphics.Rect) )。 但是,如果您的视图保留了内部选择的一些想法,例如游标或选定的行或列,则应该重写此方法并填入更具体的矩形。

Parameters
r Rect: The rectangle to fill in, in this view's coordinates.

getListPaddingBottom

Added in API level 1
int getListPaddingBottom ()

列表填充是普通视图的填充和选择器的填充的最大值。

Returns
int The bottom list padding.

也可以看看:

getListPaddingLeft

Added in API level 1
int getListPaddingLeft ()

列表填充是普通视图的填充和选择器的填充的最大值。

Returns
int The left list padding.

也可以看看:

getListPaddingRight

Added in API level 1
int getListPaddingRight ()

列表填充是普通视图的填充和选择器的填充的最大值。

Returns
int The right list padding.

也可以看看:

getListPaddingTop

Added in API level 1
int getListPaddingTop ()

列表填充是普通视图的填充和选择器的填充的最大值。

Returns
int The top list padding.

也可以看看:

getSelectedView

Added in API level 1
View getSelectedView ()

Returns
View The view corresponding to the currently selected item, or null if nothing is selected

getSelector

Added in API level 1
Drawable getSelector ()

返回用于在列表中绘制选择的选择器 Drawable

Returns
Drawable the drawable used to display the selector

getSolidColor

Added in API level 1
int getSolidColor ()

如果已知视图始终在纯色背景上绘制,并需要绘制渐变边缘,则覆盖此视图。 返回非零颜色使视图系统能够优化衰落边缘的绘制。 如果您确实返回非零颜色,则应将alpha设置为0xFF。

Returns
int The known solid color background for this view, or 0 if the color may vary

getTextFilter

Added in API level 3
CharSequence getTextFilter ()

返回列表的文本过滤器(如果可用)。

Returns
CharSequence the list's text filter or null if filtering isn't enabled

getTranscriptMode

Added in API level 1
int getTranscriptMode ()

返回当前转录模式。

Returns
int TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL or TRANSCRIPT_MODE_ALWAYS_SCROLL

getVerticalScrollbarWidth

Added in API level 1
int getVerticalScrollbarWidth ()

返回垂直滚动条的宽度。

Returns
int The width in pixels of the vertical scrollbar or 0 if there is no vertical scrollbar.

hasTextFilter

Added in API level 1
boolean hasTextFilter ()

如果ListView当前具有文本过滤器,则返回。

Returns
boolean

invalidateViews

Added in API level 1
void invalidateViews ()

导致所有视图被重建和重绘。

isFastScrollAlwaysVisible

Added in API level 11
boolean isFastScrollAlwaysVisible ()

如果快速滚动条始终显示在此视图上,则返回true。

Returns
boolean true if the fast scroller will always show

也可以看看:

isFastScrollEnabled

Added in API level 3
boolean isFastScrollEnabled ()

如果启用快速滚动条,则返回true。

Returns
boolean true if fast scroll is enabled, false otherwise

也可以看看:

isItemChecked

Added in API level 1
boolean isItemChecked (int position)

返回指定位置的选中状态。 结果仅在选择模式设置为CHOICE_MODE_SINGLECHOICE_MODE_MULTIPLE

Parameters
position int: The item whose checked state to return
Returns
boolean The item's checked state or false if choice mode is invalid

也可以看看:

isScrollingCacheEnabled

Added in API level 1
boolean isScrollingCacheEnabled ()

指示在滚动过程中是否使用儿童绘画缓存。 默认情况下,绘图缓存已启用,但会消耗更多内存。

Returns
boolean true if the scrolling cache is enabled, false otherwise

也可以看看:

isSmoothScrollbarEnabled

Added in API level 3
boolean isSmoothScrollbarEnabled ()

返回快速滚动功能的当前状态。

Returns
boolean True if smooth scrollbar is enabled is enabled, false otherwise.

也可以看看:

isStackFromBottom

Added in API level 1
boolean isStackFromBottom ()

指示此视图的内容是固定到底部边缘还是从底部边缘堆叠。

Returns
boolean true if the content is stacked from the bottom edge, false otherwise

isTextFilterEnabled

Added in API level 1
boolean isTextFilterEnabled ()

指示是否为此视图启用类型筛选

Returns
boolean true if type filtering is enabled, false otherwise

也可以看看:

jumpDrawablesToCurrentState

Added in API level 11
void jumpDrawablesToCurrentState ()

在与此视图关联的所有可绘制对象上调用 Drawable.jumpToCurrentState()

如果有一个StateListAnimator附加到这个视图,也调用 jumpToCurrentState()

onCancelPendingInputEvents

Added in API level 19
void onCancelPendingInputEvents ()

作为在此视图或父视图上致电 cancelPendingInputEvents()的结果调用。

此方法负责移除任何发布到事件队列以待稍后运行的高级输入事件。 它通过发布自己的递延高级别活动自定义视图类post(Runnable)postDelayed(Runnable, long)或者Handler应覆盖此方法,调用super.onCancelPendingInputEvents() ,并删除这些回调适当。

onCreateInputConnection

Added in API level 3
InputConnection onCreateInputConnection (EditorInfo outAttrs)

返回InputConnection以编辑过滤器文本。

Parameters
outAttrs EditorInfo: Fill in with attribute information about the connection.
Returns
InputConnection

onFilterComplete

Added in API level 1
void onFilterComplete (int count)

通知过滤操作结束。

Parameters
count int: the number of values computed by the filter

onGenericMotionEvent

Added in API level 12
boolean onGenericMotionEvent (MotionEvent event)

实现此方法来处理通用运动事件。

通用运动事件描述操纵杆运动,鼠标悬停,触控板触摸,滚轮运动和其他输入事件。 运动事件的source指定接收的输入类别。 此方法的实现必须在处理事件之前检查源中的位。 以下代码示例显示了这是如何完成的。

源类为SOURCE_CLASS_POINTER通用运动事件传递到指针下的视图。 所有其他通用运动事件都会传送到重点视图。

 public boolean onGenericMotionEvent(MotionEvent event) {
     if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) {
         if (event.getAction() == MotionEvent.ACTION_MOVE) {
             // process the joystick movement...
             return true;
         }
     }
     if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
         switch (event.getAction()) {
             case MotionEvent.ACTION_HOVER_MOVE:
                 // process the mouse hover movement...
                 return true;
             case MotionEvent.ACTION_SCROLL:
                 // process the scroll wheel movement...
                 return true;
         }
     }
     return super.onGenericMotionEvent(event);
 }

Parameters
event MotionEvent: The generic motion event being processed.
Returns
boolean True if the event was handled, false otherwise.

onGlobalLayout

Added in API level 1
void onGlobalLayout ()

当全局布局状态或视图树中视图的可见性发生更改时调用回调方法

onInitializeAccessibilityNodeInfoForItem

Added in API level 19
void onInitializeAccessibilityNodeInfoForItem (View view, 
                int position, 
                AccessibilityNodeInfo info)

使用有关列表中特定项目的信息初始化 AccessibilityNodeInfo

Parameters
view View: View representing the list item.
position int: Position of the list item within the adapter.
info AccessibilityNodeInfo: Node info to populate.

onInterceptHoverEvent

Added in API level 14
boolean onInterceptHoverEvent (MotionEvent event)

实现此方法以在由子视图处理悬停事件之前拦截悬停事件。

在将悬停事件分派给视图组的子视图或视图组自己的onHoverEvent(MotionEvent)以允许视图组有机会截获悬停事件之前调用此方法。 即使指针悬停在视图组的子视图上,而不是在视图组本身上,该方法也可用于观察视图组边界内发生的所有指针运动。

视图组可以通过实现此方法阻止其子项接收悬停事件,并返回true以指示它想要拦截悬停事件。 视图组必须从onInterceptHoverEvent(MotionEvent)持续返回true ,只要它希望继续拦截其子级的悬停事件即可。

拦截保留了不变的情况,即通过将悬停焦点从当前悬停的孩子转移到视图组或者根据需要反之,最多可以一次悬停一个视图。

如果此方法返回true且孩子已经徘徊,则子视图将首先收到悬停退出事件,然后视图组本身将收到onHoverEvent(MotionEvent)的悬停输入事件。 同样,如果此方法以前返回true以拦截悬停事件,而返回false而指针悬停在其中一个孩子的边界内,则视图组将首先接收onHoverEvent(MotionEvent)的悬停退出事件,然后悬停的孩子将接收悬停输入事件。

默认实现处理滚动条上的鼠标悬停。

Parameters
event MotionEvent: The motion event that describes the hover.
Returns
boolean True if the view group would like to intercept the hover event and prevent its children from receiving it.

onInterceptTouchEvent

Added in API level 1
boolean onInterceptTouchEvent (MotionEvent ev)

实施此方法来拦截所有触摸屏幕动作事件。 这允许您在事件发送给您的孩子时观看事件,并在任何时候掌握当前手势的所有权。

使用这个函数需要注意,因为它与View.onTouchEvent(MotionEvent)有着相当复杂的交互,并且使用它需要以正确的方式来实现这个方法。 活动将按以下顺序收到:

  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 ACTION_CANCEL, and all further events will be delivered to your onTouchEvent() method and no longer appear here.

Parameters
ev MotionEvent: The motion event being dispatched down the hierarchy.
Returns
boolean 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.

onKeyDown

Added in API level 1
boolean onKeyDown (int keyCode, 
                KeyEvent event)

KeyEvent.Callback.onKeyDown()默认实现:当 KEYCODE_DPAD_CENTERKEYCODE_ENTER被释放时,如果视图启用并且可点击,则执行按下视图。

软件键盘中的按键通常不会触发这个监听器,尽管在某些情况下有些人会选择这样做。 不要依靠这个来捕捉软件按键。

Parameters
keyCode int: a key code that represents the button pressed, from KeyEvent
event KeyEvent: the KeyEvent object that defines the button action
Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 1
boolean onKeyUp (int keyCode, 
                KeyEvent event)

的默认实现 KeyEvent.Callback.onKeyUp() :当视图进行点击 KEYCODE_DPAD_CENTERKEYCODE_ENTER或者 KEYCODE_SPACE被释放。

软件键盘中的按键通常不会触发这个监听器,尽管在某些情况下有些人会选择这样做。 不要依靠这个来捕捉软件按键。

Parameters
keyCode int: A key code that represents the button pressed, from KeyEvent.
event KeyEvent: The KeyEvent object that defines the button action.
Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onNestedFling

Added in API level 21
boolean onNestedFling (View target, 
                float velocityX, 
                float velocityY, 
                boolean consumed)

从嵌套滚动中请求投掷。

这种方法表示嵌套滚动的孩子已经检测到适合于一阵子的条件。 通常这意味着触摸滚动以velocity的滚动方向结束,沿着可滚动的轴线满足或超过minimum fling velocity

如果嵌套的滚动子视图通常会抛出,但它位于其自己的内容的边缘,则可以使用此方法代替该嵌套的滚动父级。 父母可以有选择地消费一下,或者观察孩子的情绪。

Parameters
target View: View that initiated the nested scroll
velocityX float: Horizontal velocity in pixels per second
velocityY float: Vertical velocity in pixels per second
consumed boolean: true if the child consumed the fling, false otherwise
Returns
boolean true if this parent consumed or otherwise reacted to the fling

onNestedScroll

Added in API level 21
void onNestedScroll (View target, 
                int dxConsumed, 
                int dyConsumed, 
                int dxUnconsumed, 
                int dyUnconsumed)

反应到正在进行的嵌套滚动。

当ViewParent的当前嵌套滚动子视图调度一个嵌套滚动事件时,将调用此方法。 要接收对此方法的调用,ViewParent必须先前返回true以便致电onStartNestedScroll(View, View, int)

将滚动距离的消耗部分和未消耗部分都报告给ViewParent。 例如,实现可以选择使用消费部分来匹配或追踪多个子元素的滚动位置。 未消耗部分可用于允许连续拖动多个滚动或可拖动元素,诸如在垂直抽屉内滚动列表,其中抽屉在达到内部滚动内容的边缘时开始拖动。

Parameters
target View: The descendent view controlling the nested scroll
dxConsumed int: Horizontal scroll distance in pixels already consumed by target
dyConsumed int: Vertical scroll distance in pixels already consumed by target
dxUnconsumed int: Horizontal scroll distance in pixels not consumed by target
dyUnconsumed int: Vertical scroll distance in pixels not consumed by target

onNestedScrollAccepted

Added in API level 21
void onNestedScrollAccepted (View child, 
                View target, 
                int axes)

响应成功声明嵌套滚动操作。

此方法将在onStartNestedScroll返回true后onStartNestedScroll 它为视图及其超类为嵌套滚动执行初始配置提供了机会。 如果存在这种方法的实现,则应始终调用其超类的此方法的实现。

Parameters
child View: Direct child of this ViewParent containing target
target View: View that initiated the nested scroll
axes int: Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both

onRemoteAdapterConnected

Added in API level 11
boolean onRemoteAdapterConnected ()

当适配器连接到RemoteViewsService时调用回来。

Returns
boolean

onRemoteAdapterDisconnected

Added in API level 11
void onRemoteAdapterDisconnected ()

当适配器从RemoteViewsService断开连接时回调。

onRestoreInstanceState

Added in API level 1
void onRestoreInstanceState (Parcelable state)

吊钩允许视图重新应用以前由onSaveInstanceState()生成的内部状态的表示。 这个函数永远不会被调用为null状态。

Parameters
state Parcelable: The frozen state that had previously been returned by onSaveInstanceState().

onRtlPropertiesChanged

Added in API level 17
void onRtlPropertiesChanged (int layoutDirection)

当任何RTL属性(布局方向或文本方向或文本对齐)已被更改时调用。 子类需要重写此方法以处理依赖于已解析布局方向的缓存信息,或通知继承其布局方向的子视图。 默认实现什么都不做。

Parameters
layoutDirection int: the direction of the layout

onSaveInstanceState

Added in API level 1
Parcelable onSaveInstanceState ()

钩子允许视图生成其内部状态的表示,稍后可用于创建具有相同状态的新实例。 此状态应仅包含不持久或以后不能重建的信息。 例如,您永远不会将当前位置存储在屏幕上,因为当视图的新实例放置在其视图层次结构中时会再次计算该位置。

您可能在此处存储的某些示例:文本视图中的当前光标位置(但通常不是文本本身,因为它存储在内容提供程序或其他永久性存储中),即当前在列表视图中选择的项目。

Returns
Parcelable 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.

onStartNestedScroll

Added in API level 21
boolean onStartNestedScroll (View child, 
                View target, 
                int nestedScrollAxes)

响应启动可嵌套滚动操作的后代视图,并在适当的情况下声明嵌套滚动操作。

该方法将被调用以响应调用startNestedScroll(int)的后代视图。 视图层次结构中的每个父级都将有机会通过返回true来响应和声明嵌套滚动操作。

ViewParent实现可能会重写此方法,以指示视图何时愿意支持即将开始的嵌套滚动操作。 如果它返回true,则在正在进行滚动操作期间,此ViewParent将成为目标视图的嵌套滚动父级。 当嵌套滚动完成后,此ViewParent将接收到onStopNestedScroll(View)的呼叫。

Parameters
child View: Direct child of this ViewParent containing target
target View: View that initiated the nested scroll
nestedScrollAxes int: Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both
Returns
boolean true if this ViewParent accepts the nested scroll operation

onTextChanged

Added in API level 1
void onTextChanged (CharSequence s, 
                int start, 
                int before, 
                int count)

对于与文本过滤器关联的文本观察器。 在文本更改时执行实际过滤,并负责隐藏和显示弹出窗口,显示当前输入的过滤文本。

Parameters
s CharSequence
start int
before int
count int

onTouchEvent

Added in API level 1
boolean onTouchEvent (MotionEvent ev)

实现此方法来处理触摸屏幕动作事件。

如果使用此方法检测点击操作,建议通过执行并调用performClick()来执行操作。 这将确保一致的系统行为,包括:

  • obeying click sound preferences
  • dispatching OnClickListener calls
  • handling ACTION_CLICK when accessibility features are enabled

Parameters
ev MotionEvent: The motion event.
Returns
boolean True if the event was handled, false otherwise.

onTouchModeChanged

Added in API level 1
void onTouchModeChanged (boolean isInTouchMode)

在触摸模式更改时要调用的回调方法。

Parameters
isInTouchMode boolean: True if the view hierarchy is now in touch mode, false otherwise.

onWindowFocusChanged

Added in API level 1
void onWindowFocusChanged (boolean hasWindowFocus)

当包含此视图的窗口获得或失去焦点时调用。 请注意,这与视图焦点不同:要接收关键事件,视图和其窗口都必须具有焦点。 如果一个窗口显示在需要输入焦点的窗口上,那么您自己的窗口将失去焦点,但视图焦点将保持不变。

Parameters
hasWindowFocus boolean: True if the window containing this view now has focus, false otherwise.

performItemClick

Added in API level 1
boolean performItemClick (View view, 
                int position, 
                long id)

调用OnItemClickListener(如果已定义)。 执行与点击相关的所有常规操作:报告辅助功能事件,播放声音等。

Parameters
view View: The view within the AdapterView that was clicked.
position int: The position of the view in the adapter.
id long: The row id of the item that was clicked.
Returns
boolean True if there was an assigned OnItemClickListener that was called, false otherwise is returned.

pointToPosition

Added in API level 1
int pointToPosition (int x, 
                int y)

将点映射到列表中的某个位置。

Parameters
x int: X in local coordinate
y int: Y in local coordinate
Returns
int The position of the item which contains the specified point, or INVALID_POSITION if the point does not intersect an item.

pointToRowId

Added in API level 1
long pointToRowId (int x, 
                int y)

将点映射到与该点相交的项目的rowId。

Parameters
x int: X in local coordinate
y int: Y in local coordinate
Returns
long The rowId of the item which contains the specified point, or INVALID_ROW_ID if the point does not intersect an item.

reclaimViews

Added in API level 1
void reclaimViews (List<View> views)

将此AbsListView保存的所有视图(不包括页眉和页脚)移动到提供的列表中。 这包括显示在屏幕上的视图以及存储在AbsListView内部视图回收站中的视图。

Parameters
views List: A list into which to put the reclaimed views

requestDisallowInterceptTouchEvent

Added in API level 1
void requestDisallowInterceptTouchEvent (boolean disallowIntercept)

当孩子不希望这个父母及其祖先用 onInterceptTouchEvent(MotionEvent)拦截触摸事件时 onInterceptTouchEvent(MotionEvent)

这位家长应该将此通知传递给其父母。 这位家长必须在接触期间服从这个要求(也就是说,只有在这位家长收到了或取消后才清除标志。

Parameters
disallowIntercept boolean: True if the child does not want the parent to intercept touch events.

requestLayout

Added in API level 1
void requestLayout ()

当事情发生变化时调用它,这已经使这个视图的布局无效。 这将安排视图树的布局传递。 当视图层次结构当前处于布局传递状态时( isInLayout()不应该调用此视图层次结构( isInLayout() 。如果发生布局,则可以在当前布局传递结束时(然后布局将再次运行)或当前帧结束后绘制并发生下一个布局。

覆盖此方法的子类应调用超类方法以正确处理可能的布局错误请求。

scrollListBy

Added in API level 19
void scrollListBy (int y)

将视图中的列表项目按指定的像素数滚动。

Parameters
y int: the amount of pixels to scroll by vertically

也可以看看:

setAdapter

Added in API level 11
void setAdapter (ListAdapter adapter)

设置提供数据的适配器和视图来表示这个小部件中的数据。

Parameters
adapter ListAdapter: The adapter to use to create this view's content.

setCacheColorHint

Added in API level 1
void setCacheColorHint (int color)

当设置为非零值时,缓存颜色提示表明此列表总是绘制在纯色,单色,不透明背景的顶部。 零意味着这个物体背后的是半透明的(非固体)或者不是由单一颜色构成的。 此提示不会影响此视图上的任何现有背景可绘制集(通常通过setBackgroundDrawable(Drawable)设置)。

Parameters
color int: The background color

setChoiceMode

Added in API level 1
void setChoiceMode (int choiceMode)

定义列表的选择行为。 默认情况下,列表没有任何选择行为( CHOICE_MODE_NONE )。 通过将choiceMode设置为CHOICE_MODE_SINGLE ,列表允许最多一个项目处于选定状态。 通过将choiceMode设置为CHOICE_MODE_MULTIPLE ,该列表允许选择任意数量的项目。

Parameters
choiceMode int: One of CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, or CHOICE_MODE_MULTIPLE

setDrawSelectorOnTop

Added in API level 1
void setDrawSelectorOnTop (boolean onTop)

控制是否应该在项目顶部或其后面绘制选择高亮可绘制选项。

相关XML属性:

Parameters
onTop boolean: If true, the selector will be drawn on the item it is highlighting. The default is false.

setFastScrollAlwaysVisible

Added in API level 11
void setFastScrollAlwaysVisible (boolean alwaysShow)

设置是否应始终显示快速滚动条而不是标准滚动条。 这将启用快速滚动,如果它尚未启用。

以这种方式显示的快速滚动器不会消失,并且将成为列表中的永久性固定装置。 这最好与插入滚动条样式相结合,以确保滚动条不会与内容重叠。

Parameters
alwaysShow boolean: true if the fast scroller should always be displayed, false otherwise

也可以看看:

setFastScrollEnabled

Added in API level 3
void setFastScrollEnabled (boolean enabled)

指定是否启用快速滚动。

当启用快速滚动时,用户可以通过拖动快速滚动快速键来快速滚动列表。

如果支持此列表的适配器实现SectionIndexer ,则快速滚动器将在用户滚动时显示节头预览。 此外,用户可以通过点击滚动条的长度快速跳转部分。

Parameters
enabled boolean: true to enable fast scrolling, false otherwise

也可以看看:

setFastScrollStyle

Added in API level 21
void setFastScrollStyle (int styleResId)

指定快速滚动装饰的风格。

Parameters
styleResId int: style resource containing fast scroller properties

也可以看看:

setFilterText

Added in API level 1
void setFilterText (String filterText)

设置文本过滤器的初始值。

Parameters
filterText String: The text to use for the filter.

也可以看看:

setFriction

Added in API level 11
void setFriction (float friction)

施加在fl上的摩擦量。 默认值是getScrollFriction()

Parameters
friction float

setItemChecked

Added in API level 1
void setItemChecked (int position, 
                boolean value)

设置指定位置的选中状态。 该选项仅在选择模式设置为CHOICE_MODE_SINGLECHOICE_MODE_MULTIPLE

Parameters
position int: The item whose checked state is to be checked
value boolean: The new checked state for the item

setMultiChoiceModeListener

Added in API level 11
void setMultiChoiceModeListener (AbsListView.MultiChoiceModeListener listener)

设置一个AbsListView.MultiChoiceModeListener将管理选择的生命周期ActionMode 仅在选择模式设置为CHOICE_MODE_MULTIPLE_MODAL

Parameters
listener AbsListView.MultiChoiceModeListener: Listener that will manage the selection mode

也可以看看:

setOnScrollListener

Added in API level 1
void setOnScrollListener (AbsListView.OnScrollListener l)

设置每次列表滚动时都会收到通知的侦听器。

Parameters
l AbsListView.OnScrollListener: the scroll listener

setOverScrollMode

Added in API level 9
void setOverScrollMode (int mode)

为此视图设置过卷模式。 有效的滚动模式有OVER_SCROLL_ALWAYS (默认), OVER_SCROLL_IF_CONTENT_SCROLLS (仅当视图内容大于容器时才允许过度滚动)或OVER_SCROLL_NEVER 仅当视图能够滚动时才能设置视图的滚动模式。

Parameters
mode int: The new over-scroll mode for this view.

setRecyclerListener

Added in API level 1
void setRecyclerListener (AbsListView.RecyclerListener listener)

设置回收站侦听器,只要在回收站中留出View以供日后重新使用时通知。 这个监听器可以用来释放与视图关联的资源。

Parameters
listener AbsListView.RecyclerListener: The recycler listener to be notified of views set aside in the recycler.

也可以看看:

setRemoteViewsAdapter

Added in API level 11
void setRemoteViewsAdapter (Intent intent)

设置此AbsListView以使用通过指定意图连接到RemoteViewsService的远程视图适配器。

Parameters
intent Intent: the intent used to identify the RemoteViewsService for the adapter to connect to.

setScrollBarStyle

Added in API level 1
void setScrollBarStyle (int style)

指定滚动条的样式。 滚动条可以重叠或嵌入。 插入时,它们添加到视图的填充。 滚动条可以在填充区域或视图的边缘内绘制。 例如,如果视图具有可绘制背景,并且您想要在drawable指定的填充内绘制滚动条,则可以使用SCROLLBARS_INSIDE_OVERLAY或SCROLLBARS_INSIDE_INSET。 如果您希望它们出现在视图边缘,忽略填充,则可以使用SCROLLBARS_OUTSIDE_OVERLAY或SCROLLBARS_OUTSIDE_INSET。

Parameters
style int: the style of the scrollbars. Should be one of SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.

setScrollIndicators

Added in API level 1
void setScrollIndicators (View up, 
                View down)

Parameters
up View
down View

setScrollingCacheEnabled

Added in API level 1
void setScrollingCacheEnabled (boolean enabled)

在滚动过程中启用或禁用儿童的绘图缓存。 默认情况下,绘图缓存已启用,但会使用更多内存。 滚动缓存启用时,缓存在第一次滚动后保留。 您可以通过调用setChildrenDrawingCacheEnabled(boolean)手动清除缓存。

Parameters
enabled boolean: true to enable the scroll cache, false otherwise

也可以看看:

setSelectionFromTop

Added in API level 1
void setSelectionFromTop (int position, 
                int y)

设置选定的项目并将选择y像素从ListView的顶部边缘放置。 (如果在触摸模式下,该项目将不会被选中,但它仍将被正确定位。)

Parameters
position int: Index (starting at 0) of the data item to be selected.
y int: The distance from the top edge of the ListView (plus padding) that the item will be positioned.

setSelector

Added in API level 1
void setSelector (int resID)

设置应该用于突出显示当前选定项目的Drawable。

相关XML属性:

Parameters
resID int: A Drawable resource to use as the selection highlight.

setSelector

Added in API level 1
void setSelector (Drawable sel)

Parameters
sel Drawable

setSmoothScrollbarEnabled

Added in API level 3
void setSmoothScrollbarEnabled (boolean enabled)

当启用平滑滚动条时,滚动条缩略图的位置和大小将根据可见项目中可见像素的数量进行计算。 然而,这假定所有列表项目具有相同的高度。 如果您使用的项目具有不同高度的列表,则滚动条将在用户滚动列表时更改外观。 为了避免这个问题,你需要禁用这个属性。 当平滑滚动条被禁用时,滚动条缩略图的位置和大小仅基于适配器中的项目数量和适配器内可见项目的位置。 这提供了一个稳定的滚动条,因为用户在不同高度的项目列表中导航。

相关XML属性:

Parameters
enabled boolean: Whether or not to enable smooth scrollbar.

也可以看看:

setStackFromBottom

Added in API level 1
void setStackFromBottom (boolean stackFromBottom)

当从底部开始堆栈设置为true时,列表将从视图底部开始填充其内容。

Parameters
stackFromBottom boolean: true to pin the view's content to the bottom edge, false to pin the view's content to the top edge

setTextFilterEnabled

Added in API level 1
void setTextFilterEnabled (boolean textFilterEnabled)

启用或禁用类型筛选器窗口。 如果启用,在此视图具有焦点时键入将过滤孩子以匹配用户输入。 请注意,此视图使用的Adapter必须实现Filterable接口。

Parameters
textFilterEnabled boolean: true to enable type filtering, false otherwise

也可以看看:

setTranscriptMode

Added in API level 1
void setTranscriptMode (int mode)

将列表或网格放入记录模式。 在此模式下,列表或网格将始终滚动到底部以显示新项目。

Parameters
mode int: the transcript mode to set

也可以看看:

setVelocityScale

Added in API level 11
void setVelocityScale (float scale)

设置闪光速度的比例因子。 初始比例因子是1.0。

Parameters
scale float: The scale factor to multiply the velocity by.

setVerticalScrollbarPosition

Added in API level 11
void setVerticalScrollbarPosition (int position)

设置垂直滚动条的位置。 应该是一个SCROLLBAR_POSITION_DEFAULTSCROLLBAR_POSITION_LEFT或者SCROLLBAR_POSITION_RIGHT

Parameters
position int: Where the vertical scroll bar should be positioned.

showContextMenu

Added in API level 24
boolean showContextMenu (float x, 
                float y)

显示锚定到指定视图相对坐标的此视图的上下文菜单。

Parameters
x float: the X coordinate in pixels relative to the view to which the menu should be anchored, or NaN to disable anchoring
y float: the Y coordinate in pixels relative to the view to which the menu should be anchored, or NaN to disable anchoring
Returns
boolean true if the context menu was shown, false otherwise

showContextMenu

Added in API level 1
boolean showContextMenu ()

显示该视图的上下文菜单。

Returns
boolean true if the context menu was shown, false otherwise

showContextMenuForChild

Added in API level 24
boolean showContextMenuForChild (View originalView, 
                float x, 
                float y)

显示指定视图或其祖先的上下文菜单,该上下文菜单被锚定到指定的视图相对坐标。

在大多数情况下,子类不需要覆盖它。 但是,如果子类直接添加到窗口管理器(例如, addView(View, android.view.ViewGroup.LayoutParams) ),那么它应该覆盖此并显示上下文菜单。

如果一个子类重写这个方法,它也应该覆盖 showContextMenuForChild(View)

Parameters
originalView View: the source view where the context menu was first invoked
x float: the X coordinate in pixels relative to the original view to which the menu should be anchored, or NaN to disable anchoring
y float: the Y coordinate in pixels relative to the original view to which the menu should be anchored, or NaN to disable anchoring
Returns
boolean true if the context menu was shown, false otherwise

showContextMenuForChild

Added in API level 1
boolean showContextMenuForChild (View originalView)

显示指定视图或其祖先的上下文菜单。

在大多数情况下,子类不需要覆盖它。 但是,如果子类直接添加到窗口管理器(例如, addView(View, android.view.ViewGroup.LayoutParams) ),那么它应覆盖此并显示上下文菜单。

Parameters
originalView View: the source view where the context menu was first invoked
Returns
boolean true if the context menu was shown, false otherwise

smoothScrollBy

Added in API level 8
void smoothScrollBy (int distance, 
                int duration)

在持续时间毫秒内平滑滚动像素距离。

Parameters
distance int: Distance to scroll in pixels.
duration int: Duration of the scroll animation in milliseconds.

smoothScrollToPosition

Added in API level 8
void smoothScrollToPosition (int position)

平滑地滚动到指定的适配器位置。 视图将滚动显示指定的位置。

Parameters
position int: Scroll to this adapter position.

smoothScrollToPosition

Added in API level 8
void smoothScrollToPosition (int position, 
                int boundPosition)

平滑地滚动到指定的适配器位置。 视图将滚动,以便显示指定的位置,但如果进一步滚动将滚动boundPosition到视图外,它将提前停止。

Parameters
position int: Scroll to this adapter position.
boundPosition int: Do not scroll if it would move this adapter position out of view.

smoothScrollToPositionFromTop

Added in API level 11
void smoothScrollToPositionFromTop (int position, 
                int offset, 
                int duration)

平滑地滚动到指定的适配器位置。 视图将滚动,以便在视图顶部边缘下方显示offset像素的指示位置。 如果这是不可能的(例如,偏移量会将第一个或最后一个项目滚动到列表边界之外),它将尽可能接近。 滚动将花费duration毫秒完成。

Parameters
position int: Position to scroll to
offset int: Desired distance in pixels of position from the top of the view when scrolling is finished
duration int: Number of milliseconds to use for the scroll

smoothScrollToPositionFromTop

Added in API level 11
void smoothScrollToPositionFromTop (int position, 
                int offset)

平滑地滚动到指定的适配器位置。 视图将滚动,以便在视图顶部边缘下方显示offset像素的指示位置。 如果这是不可能的(例如,偏移量会将第一个或最后一个项目滚动到列表边界之外),它将尽可能接近。

Parameters
position int: Position to scroll to
offset int: Desired distance in pixels of position from the top of the view when scrolling is finished

verifyDrawable

Added in API level 1
boolean verifyDrawable (Drawable dr)

如果你的视图子类正在显示它自己的Drawable对象,它应该覆盖这个函数,并且对于它显示的任何Drawable返回true。 这样可以安排这些可绘制的动画。

重写此功能时,一定要调用超类。

Parameters
dr Drawable: 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 boolean If true than the Drawable is being displayed in the view; else false and it is not allowed to animate.

Protected methods

checkLayoutParams

Added in API level 1
boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams
Returns
boolean

computeVerticalScrollExtent

Added in API level 1
int computeVerticalScrollExtent ()

计算垂直滚动条拇指在垂直范围内的垂直范围。 该值用于计算滚动条轨道内的拇指长度。

范围以任意单位表示,必须与 computeVerticalScrollRange()computeVerticalScrollOffset()使用的单位相同。

默认范围是此视图的绘图高度。

Returns
int the vertical extent of the scrollbar's thumb

computeVerticalScrollOffset

Added in API level 1
int computeVerticalScrollOffset ()

计算垂直滚动条拇指在水平范围内的垂直偏移量。 该值用于计算滚动条轨道内的拇指位置。

范围以任意单位表示,必须与 computeVerticalScrollRange()computeVerticalScrollExtent()使用的单位相同。

默认偏移量是该视图的滚动偏移量。

Returns
int the vertical offset of the scrollbar's thumb

computeVerticalScrollRange

Added in API level 1
int computeVerticalScrollRange ()

计算垂直滚动条代表的垂直范围。

范围以任意单位表示,必须与 computeVerticalScrollExtent()computeVerticalScrollOffset()使用的单位相同。

Returns
int the total vertical range represented by the vertical scrollbar

默认范围是此视图的绘图高度。

dispatchDraw

Added in API level 1
void dispatchDraw (Canvas canvas)

通过绘制来绘制子视图。 这可能会被派生类重写,以便在子对象被绘制之前获得控制权(但在绘制自己的视图之后)。

Parameters
canvas Canvas: the canvas on which to draw the view

dispatchSetPressed

Added in API level 1
void dispatchSetPressed (boolean pressed)

派发setPressed给所有这个View的孩子。

Parameters
pressed boolean: The new pressed state

drawableStateChanged

Added in API level 1
void drawableStateChanged ()

只要视图的状态发生变化,就会调用此函数,使得它影响所显示的可绘制状态。

如果View有一个StateListAnimator,它也将被调用来运行必要的状态改变动画。

重写此功能时,一定要调用超类。

generateDefaultLayoutParams

Added in API level 1
ViewGroup.LayoutParams generateDefaultLayoutParams ()

返回一组默认布局参数。 传递给addView(View)的View没有设置布局参数时请求这些参数。 如果返回null,则会从addView引发异常。

Returns
ViewGroup.LayoutParams a set of default layout parameters or null

generateLayoutParams

Added in API level 1
ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

根据提供的布局参数返回一组安全的布局参数。 当一个ViewGroup传递了一个View,其布局参数不能通过checkLayoutParams(android.view.ViewGroup.LayoutParams)的测试时,这个方法就会被调用。 此方法应该返回一组适合此ViewGroup的布局参数,可能是通过从指定的一组布局参数中复制适当的属性。

Parameters
p ViewGroup.LayoutParams: The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.
Returns
ViewGroup.LayoutParams an instance of ViewGroup.LayoutParams or one of its descendants

getBottomFadingEdgeStrength

Added in API level 1
float getBottomFadingEdgeStrength ()

返回底部渐变边的强度或强度。 强度是介于0.0(无褪色)和1.0(全褪色)之间的值。 默认实现返回0.0或1.0,但两者之间没有值。 滚动发生时,子类应该重写此方法以提供更平滑的淡入淡出转换。

Returns
float the intensity of the bottom fade as a float between 0.0f and 1.0f

getBottomPaddingOffset

Added in API level 2
int getBottomPaddingOffset ()

扩展底部衰落区域的数量。 仅当isPaddingOffsetRequired()返回true时才调用。

Returns
int The bottom padding offset in pixels.

getContextMenuInfo

Added in API level 1
ContextMenu.ContextMenuInfo getContextMenuInfo ()

视图应该实现这个,如果他们有额外的信息与上下文菜单相关联。 返回结果作为参数提供给onCreateContextMenu(ContextMenu, View, ContextMenuInfo)回调。

Returns
ContextMenu.ContextMenuInfo Extra information about the item for which the context menu should be shown. This information will vary across different subclasses of View.

getLeftPaddingOffset

Added in API level 2
int getLeftPaddingOffset ()

扩展左衰落区域的量。 仅在isPaddingOffsetRequired()返回true时调用。

Returns
int The left padding offset in pixels.

getRightPaddingOffset

Added in API level 2
int getRightPaddingOffset ()

扩展正确衰落区域的数量。 仅当isPaddingOffsetRequired()返回true时才调用。

Returns
int The right padding offset in pixels.

getTopFadingEdgeStrength

Added in API level 1
float getTopFadingEdgeStrength ()

返回顶部褪色边缘的强度或强度。 强度是介于0.0(无褪色)和1.0(全褪色)之间的值。 默认实现返回0.0或1.0,但两者之间没有值。 滚动发生时,子类应该重写此方法以提供更平滑的淡入淡出转换。

Returns
float the intensity of the top fade as a float between 0.0f and 1.0f

getTopPaddingOffset

Added in API level 2
int getTopPaddingOffset ()

扩大最大衰落区域的数量。 仅在isPaddingOffsetRequired()返回true时调用。

Returns
int The top padding offset in pixels.

handleDataChanged

Added in API level 1
void handleDataChanged ()

isInFilterMode

Added in API level 1
boolean isInFilterMode ()

指示此视图是否处于过滤器模式。 过滤器模式可以例如由用户在键盘上打字时启用。

Returns
boolean True if the view is in filter mode, false otherwise.

isPaddingOffsetRequired

Added in API level 2
boolean isPaddingOffsetRequired ()

如果视图在其填充内绘制内容并启用淡化边缘,则需要支持填充偏移。 将填充偏移添加到淡出边缘以延长淡入淡出的长度,以便覆盖填充内部绘制的像素。 如果需要在填充内绘制内容,则此类的子类应该重写此方法。

Returns
boolean True if padding offset must be applied, false otherwise.

layoutChildren

Added in API level 1
void layoutChildren ()

子类必须重写此方法来布局他们的子项。

onAttachedToWindow

Added in API level 1
void onAttachedToWindow ()

这在视图附加到窗口时被调用。 此时它有一个Surface并将开始绘制。 请注意,此功能保证在onDraw(android.graphics.Canvas)之前onDraw(android.graphics.Canvas) ,但可以在第一次onDraw之前的任何时候调用此函数 - 包括onMeasure(int, int)之前或之后。

onDetachedFromWindow

Added in API level 1
void onDetachedFromWindow ()

这是在视图从窗口分离时调用的。 此时它不再有绘图表面。

onDisplayHint

Added in API level 8
void onDisplayHint (int hint)

给出这个观点暗示是否显示。 例如,当视图移出屏幕时,它可能会收到显示提示,指示视图不显示。 应用程序不应该依赖这个提示,因为不能保证他们会收到一个。

Parameters
hint int: A hint about whether or not this view is displayed: VISIBLE or INVISIBLE.

onFocusChanged

Added in API level 1
void onFocusChanged (boolean gainFocus, 
                int direction, 
                Rect previouslyFocusedRect)

当视图的焦点状态改变时,由视图系统调用。 当焦点更改事件是由方向导航导致的,direction和previouslyFocusedRect提供了焦点来自何处的洞察。 重写时,一定要调用超类,以便进行标准的焦点处理。

Parameters
gainFocus boolean: True if the View has focus; false otherwise.
direction int: The direction focus has moved when requestFocus() is called to give this view focus. Values are FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, or FOCUS_BACKWARD. It may not always apply, in which case use the default.
previouslyFocusedRect Rect: 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.

onLayout

Added in API level 1
void onLayout (boolean changed, 
                int l, 
                int t, 
                int r, 
                int b)

子类不应该重写此方法,而是 layoutChildren()

Parameters
changed boolean: This is a new size or position for this view
l int: Left position, relative to parent
t int: Top position, relative to parent
r int: Right position, relative to parent
b int: Bottom position, relative to parent

onMeasure

Added in API level 1
void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

测量视图及其内容以确定测量宽度和测量高度。 此方法由measure(int, int)调用, measure(int, int)子类覆盖以提供其内容的准确和高效的度量。

合同:覆盖此方法时,您必须致电setMeasuredDimension(int, int)来存储此视图的测量宽度和高度。 不这样做会触发IllegalStateException ,由measure(int, int)引发。 调用超类' onMeasure(int, int)是一个有效的用法。

Measure的基类实现默认为背景大小,除非MeasureSpec允许更大的大小。 子类应该覆盖onMeasure(int, int)以提供更好的内容度量。

如果此方法被覆盖,则子类的责任是确保测量的高度和宽度至少为视图的最小高度和宽度( getSuggestedMinimumHeight()getSuggestedMinimumWidth() )。

Parameters
widthMeasureSpec int: horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec int: vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

onOverScrolled

Added in API level 9
void onOverScrolled (int scrollX, 
                int scrollY, 
                boolean clampedX, 
                boolean clampedY)

overScrollBy(int, int, int, int, int, int, int, int, boolean)调用以响应过度滚动操作的结果。

Parameters
scrollX int: New X scroll value in pixels
scrollY int: New Y scroll value in pixels
clampedX boolean: True if scrollX was clamped to an over-scroll boundary
clampedY boolean: True if scrollY was clamped to an over-scroll boundary

onSizeChanged

Added in API level 1
void onSizeChanged (int w, 
                int h, 
                int oldw, 
                int oldh)

当这个视图的大小发生变化时,这在布局期间被调用。 如果您刚刚添加到视图层次结构中,则会使用旧值0调用。

Parameters
w int: Current width of this view.
h int: Current height of this view.
oldw int: Old width of this view.
oldh int: Old height of this view.

Hooray!