Android7.0中文文档(API) -- HorizontalScrollView

来源:互联网 发布:茅台防伪溯源软件下载 编辑:程序博客网 时间:2024/06/05 09:42

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/HorizontalScrollView.html

HorizontalScrollView

public class HorizontalScrollView
extendsFrameLayout

java.lang.Object   ↳android.view.View    ↳android.view.ViewGroup     ↳android.widget.FrameLayout      ↳android.widget.HorizontalScrollView
已知的直接子类


Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A HorizontalScrollView is aFrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a horizontal orientation, presenting a horizontal array of top-level items that the user can scroll through.
视图层次结构的布局容器,可以由用户进行滚动,允许它的内容比物理显示屏更大。HorizontalScrollView是一个FrameLayout,这意味着你应该在其中放置一个子项来滚动,其包含了所有的内容;这个子项本身可能是一个具有复杂的对象层次结构的布局管理器。子项经常在水平方位中,使用一个LinearLayout,其呈现了一个顶层项的水平排列,用户可以滚动浏览。

The TextView class also takes care of its own scrolling, so does not require a HorizontalScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.
TextView类也负责它自己的滚动,因此不需要HorizontalScrollView,但是同时使用,可以实现在较大容器中的显示文本视图的效果。

HorizontalScrollView only supports horizontal scrolling. For vertical scrolling, use eitherScrollView orListView.
HorizontalScrollView只支持水平方向的滚动。对于垂直方向的滚动,请使用哦那个ScrollViewListView

摘要


XML属性

android:fillViewport设置scrollview是否应拉伸其内容以填充可视区域。 

继承XML属性

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

继承常量

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

继承字段

From class android.view.View

Public构造方法

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

Public方法

voidaddView(View child, int index)

Adds a child view.
添加一个子视图。

voidaddView(View child)

Adds a child view.
添加一个子视图。

voidaddView(View child, ViewGroup.LayoutParams params)

Adds a child view with the specified layout parameters.
添加具有指定布局参数的子视图。

voidaddView(View child, int index, ViewGroup.LayoutParams params)

Adds a child view with the specified layout parameters.
添加具有指定布局参数的子视图。

booleanarrowScroll(int direction)

Handle scrolling in response to a left or right arrow click.
处理左右箭头键的滚动。

voidcomputeScroll()

Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
由父项调用, 以请求子项在必要时,更新mScrollX和mScrollY的值。

booleandispatchKeyEvent(KeyEvent event)

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

voiddraw(Canvas canvas)

Manually render this view (and all of its children) to the given Canvas.
手动将此视图 (及其所有子项) 渲染到指定的Canvas。

booleanexecuteKeyEvent(KeyEvent event)

You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy.
你可以自己调用这个函数,让滚动视图从一个按键事件中执行滚动,就好像事件已经被视图层次结构派发给它一样。

voidfling(int velocityX)

Fling the scroll view
Fling滚动视图

booleanfullScroll(int direction)

Handles scrolling in response to a "home/end" shortcut press.
处理按下“home/end”快捷键的滚动。

CharSequencegetAccessibilityClassName()

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

intgetMaxScrollAmount()booleanisFillViewport()

Indicates whether this HorizontalScrollView's content is stretched to fill the viewport.
这个HorizontalScrollView的内容是否被拉伸,以填充视口(viewport)。

booleanisSmoothScrollingEnabled()booleanonGenericMotionEvent(MotionEvent event)

Implement this method to handle generic motion events.
实现此方法以处理普通的MotionEvent。

booleanonInterceptTouchEvent(MotionEvent ev)

Implement this method to intercept all touch screen motion events.
实现此方法可拦截所有触摸屏MotionEvent。

booleanonTouchEvent(MotionEvent ev)

Implement this method to handle touch screen motion events.
实现此方法,以处理触摸屏的MotionEvent。

booleanpageScroll(int direction)

Handles scrolling in response to a "page up/down" shortcut press.
处理按下“page up/down”快捷键的滚动。

voidrequestChildFocus(View child, View focused)

Called when a child of this parent wants focus
当此父项的子项请求焦点时调用。

booleanrequestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate)

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

voidrequestDisallowInterceptTouchEvent(boolean disallowIntercept)

Called when a child does not want this parent and its ancestors to intercept touch events withonInterceptTouchEvent(MotionEvent).
当一个子项不希望此父项,通过onInterceptTouchEvent(MotionEvent)截获TouchEvent时调用。

voidrequestLayout()

Call this when something has changed which has invalidated the layout of this view.
当使此视图的布局失效事件发生时, 调用此方法。

voidscrollTo(int x, int y)

Set the scrolled position of your view.
设置此视图到滚动位置。

This version also clamps the scrolling to the bounds of our child.
这个版本还将控制滚动到子项的边界。

voidsetFillViewport(boolean fillViewport)

Indicates this HorizontalScrollView whether it should stretch its content width to fill the viewport or not.
此HorizontalScrollView 是否应该拉伸它的内容宽度来填充视口(viewport)。

voidsetOverScrollMode(int mode)

Set the over-scroll mode for this view.
设置此视图的over-scroll模式。

voidsetSmoothScrollingEnabled(boolean smoothScrollingEnabled)

Set whether arrow scrolling will animate its transition.
设置箭头滚动是否使用动画转换。

booleanshouldDelayChildPressedState()

Return true if the pressed state should be delayed for children or descendants of this ViewGroup.
如果这个ViewGroup的子项要延迟按下的状态,则返回true。

final voidsmoothScrollBy(int dx, int dy)

Like scrollBy(int, int), but scroll smoothly instead of immediately.
scrollBy(int, int),但将平滑的滚动,而不是立刻到目的位置。

final voidsmoothScrollTo(int x, int y)

Like scrollTo(int, int), but scroll smoothly instead of immediately.
scrollTo(int, int),但将平滑的滚动,而不是立刻到目的位置。

保护方法

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/HorizontalScrollView.html