完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/HorizontalScrollView.html
HorizontalScrollView
public class HorizontalScrollView
extends FrameLayout
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 a FrameLayout
, 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 either ScrollView
or ListView
.
HorizontalScrollView只支持水平方向的滚动。对于垂直方向的滚动,请使用哦那个ScrollView
或ListView
。
摘要
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方法 | |
---|---|
void | addView(View child, int index) Adds a child view. |
void | addView(View child) Adds a child view. |
void | addView(View child, ViewGroup.LayoutParams params) Adds a child view with the specified layout parameters. |
void | addView(View child, int index, ViewGroup.LayoutParams params) Adds a child view with the specified layout parameters. |
boolean | arrowScroll(int direction) Handle scrolling in response to a left or right arrow click. |
void | computeScroll() Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. |
boolean | dispatchKeyEvent(KeyEvent event) Dispatch a key event to the next view on the focus path. |
void | draw(Canvas canvas) Manually render this view (and all of its children) to the given Canvas. |
boolean | executeKeyEvent(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. |
void | fling(int velocityX) Fling the scroll view |
boolean | fullScroll(int direction) Handles scrolling in response to a "home/end" shortcut press. |
CharSequence | getAccessibilityClassName() Return the class name of this object to be used for accessibility purposes. |
int | getMaxScrollAmount() |
boolean | isFillViewport() Indicates whether this HorizontalScrollView's content is stretched to fill the viewport. |
boolean | isSmoothScrollingEnabled() |
boolean | onGenericMotionEvent(MotionEvent event) Implement this method to handle generic motion events. |
boolean | onInterceptTouchEvent(MotionEvent ev) Implement this method to intercept all touch screen motion events. |
boolean | onTouchEvent(MotionEvent ev) Implement this method to handle touch screen motion events. |
boolean | pageScroll(int direction) Handles scrolling in response to a "page up/down" shortcut press. |
void | requestChildFocus(View child, View focused) Called when a child of this parent wants focus |
boolean | requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) Called when a child of this group wants a particular rectangle to be positioned onto the screen. |
void | requestDisallowInterceptTouchEvent(boolean disallowIntercept) Called when a child does not want this parent and its ancestors to intercept touch events with |
void | requestLayout() Call this when something has changed which has invalidated the layout of this view. |
void | scrollTo(int x, int y) Set the scrolled position of your view. This version also clamps the scrolling to the bounds of our child. |
void | setFillViewport(boolean fillViewport) Indicates this HorizontalScrollView whether it should stretch its content width to fill the viewport or not. |
void | setOverScrollMode(int mode) Set the over-scroll mode for this view. |
void | setSmoothScrollingEnabled(boolean smoothScrollingEnabled) Set whether arrow scrolling will animate its transition. |
boolean | shouldDelayChildPressedState() Return true if the pressed state should be delayed for children or descendants of this ViewGroup. |
final void | smoothScrollBy(int dx, int dy) Like |
final void | smoothScrollTo(int x, int y) Like |