完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ScrollView.html
ScrollView
public class ScrollView
extends FrameLayout
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.widget.ScrollView |
Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView 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 vertical orientation, presenting a vertical array of top-level items that the user can scroll through.
视图层次结构的布局容器,可以由用户进行滚动,允许它的内容比物理显示屏更大。ScrollView是一个FrameLayout
,这意味着你应该在其中放置一个子项来滚动,其包含了所有的内容;这个子项本身可能是一个具有复杂的对象层次结构的布局管理器。子项经常在垂直方位中,使用一个LinearLayout
,其呈现了一个顶层项的垂直排列,用户可以滚动浏览。
You should never use a ScrollView with a ListView
, because ListView takes care of its own vertical scrolling. Most importantly, doing this defeats all of the important optimizations in ListView for dealing with large lists, since it effectively forces the ListView to display its entire list of items to fill up the infinite container supplied by ScrollView.
你不能将ScrollView和ListView
一起使用,因为ListView负责自己的垂直滚动操作。最重要的是,这样做会破坏ListView中为处理大型列表所有重要的优化,因为它有效地迫使ListView显示它的整个列表,以填充由ScrollView提供的无限容器。
The TextView
class also takes care of its own scrolling, so does not require a ScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.
TextView
类也负责它自己的滚动,因此不需要ScrollView,但是同时使用,可以实现在较大容器中的显示文本视图的效果。
ScrollView only supports vertical scrolling. For horizontal scrolling, use HorizontalScrollView
.
ScrollView仅支持垂直滚动。关于水平滚动,请使用HorizontalScrollView
。
摘要
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构造方法 | |
---|---|
ScrollView(Context context) | |
ScrollView(Context context, AttributeSet attrs) | |
ScrollView(Context context, AttributeSet attrs, int defStyleAttr) | |
ScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) |
Public方法
完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ScrollView.html