scrollView为什么只有一个子布局

来源:互联网 发布:淘宝15天自动确认收货 编辑:程序博客网 时间:2024/04/27 23:40
 * 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 {@link 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 {@link LinearLayout} in a vertical orientation, presenting a vertical
 * array of top-level items that the user can scroll through.
 * <p>You should never use a ScrollView with a {@link 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.
 * <p>The {@link 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.
 *
 * <p>ScrollView only supports vertical scrolling. For horizontal scrolling,

 * use {@link HorizontalScrollView}.

看到官方的文档他的作用是为了让一个布局可以滑动,并且A ScrollView
 * is a {@link FrameLayout}, meaning you should place one child in it说的是他是一个帧布局,故只能有一个子布局了

记下来提醒自己

0 0
原创粉丝点击