Android-什么时候用ScrollView
什么时候用 ScrollView ?
答:像以下这种情况,就是使用ScrollView;
摆放无顺序,无规律,并会超出屏幕的高度,就可以用ScrollView

错误的ScrollView示范,ScrollView只能包含一个孩子:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"> <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="11" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="14" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="17" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="18" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20" /> </ScrollView> </RelativeLayout>
错误的ScrollView示范,ScrollView只能包含一个孩子,包含多个就会报错(ScrollView只能包含一个孩子):

正确的示范:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"> <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"> <!-- ScrollView里面只能包含一个孩子,才是正确的Android-什么时候用ScrollView的更多相关文章
- android 滚动视图(ScrollView)
为了可以让内嵌布局管理器之中加入多个显示的组件,而且又保证程序不这么冗余,所以可以通过 Activity程序进行控制,向内嵌布局管理器中添加多个组件. ScrollView提供一个显示的容器,可以包含 ...
- android用户界面之ScrollView教程实例汇总
--------------------------汇总不容易啊------------------------------- 一.ScrollView基础知识 1.Android中ScrollVie ...
- Android长截屏-- ScrollView,ListView及RecyclerView截屏
http://blog.csdn.net/wbwjx/article/details/46674157 Android长截屏-- ScrollView,ListView及RecyclerV ...
- android 开发-ListView与ScrollView事件冲突处理(事件分发机制处理)
ListView和ScrollView都存在滚动的效果,所以一般不建议listView和scrollView进行嵌套使用,但有些需求则需要用到两者嵌套.在android的学习中学了一种事件分发处理机制 ...
- Android基础控件ScrollView滚动条的使用
1.简介 ScrollView是一个FrameLayout的容器,不过在他的基础上添加了滚动,允许显示的比实际多的内容!另外,只能够往里面放置一个子元素,可以是单一的组件,又或者一个布局包裹着的复杂的 ...
- android 有弹性的ScrollView 简单实现,与处理ScrollView和ListView,GridView之间的冲突
处理ScrollView和ListView,GridView之间的冲突, 最好的办法就是继承这两个类,重写他们的onMeasure方法即可: ListView: import android.widg ...
- android基础开发之scrollview
scrollView 是android系统提供的一种 特殊的展示view. 其实我们很早就遇到过scrollview的东东,比如listview. 而google官方文档也提出,不要混合使用scrol ...
- Android实现两个ScrollView互相联动,同步滚动的效果
公众号:smart_android 作者:loonggg 点击"阅读原文",可查看更多内容和干货 最近在做一个项目,用到了两个ScrollView互相联动的效果,简单来说联动效果意 ...
- android学习笔记11——ScrollView
ScrollView——滚动条 用于内容显示不全,可提供滚动条下来形式,显示其余内容. ScrollView和HorizontalScrollView是为控件或者布局添加滚动条 特点如下: 1.只能有 ...
- Android中监听ScrollView滑动停止和滑动到底部
1.监听ScrollView滑动停止: /********************监听ScrollView滑动停止*****************************/ scrollView.s ...
随机推荐
- Android APP压力测试实战
环境准备: Android SDK Python 压测实战步骤 1.在手机开发者工具中,将USB调试选上 2.确认手机,电脑成功连接(通过adb devices) 3.安装测试app(adb in ...
- 新浪微博Oauth2.0授权 获取Access Token
新浪微博开放平台提供了丰富的API接口,利用这些接口,开发者能够开发出独具特色的微博应用.但是,大部分接口都需要用户授权给应用,应用利用授权得到的Access Token来调用相应的接口来获取内容. ...
- sort_region——对区域进行排序
The operator sort_region sorts the regions with respect to their relative position. All sorting meth ...
- ES6中新添加的Array.prototype.fill
用法 array.fill(start=0, end=this.length) 示例 [1, 2, 3].fill(4) // [4, 4, 4] [1, 2, 3].fill(4, 1) // [1 ...
- Linux任务前后台的切换(转)
Linux任务前后台的切换 Shell支持作用控制,有以下命令实现前后台切换: 1. command& 让进程在后台运行 2. jobs 查看后台运行的进程 3. fg %n 让后台运行的 ...
- 动态添加一列到DataTable的第一列
dt.Columns.Add("ROWNUM", typeof(Int64));dt.Columns["ROWNUM"].SetOrdinal(0);
- Zookeeper的基本概念和重要特性
目录 1. 什么是Zookeeper 2. Zookeeper集群角色 3. Zookeeper的数据模型 3.1 Znode的类型 3.2 Znode的结构 4. Zookeeper的事件监听机制 ...
- Java多线程—JUC原子类
根据修改的数据类型,可以将JUC包中的原子操作类可以分为4类. 1. 基本类型: AtomicInteger, AtomicLong, AtomicBoolean ;2. 数组类型: AtomicIn ...
- p4364 [九省联考2018]IIIDX
传送门 分析 我们先考虑如果所有数都不相同我们应该怎么办 我们可以直接贪心的在每个点放可行的最大权值 但是题目要求可以有相同的数 我们可以考虑每次让当前节点可发且尽量大的同时给兄弟节点留的数尽量大 我 ...
- Java Persistence with MyBatis 3(中文版) 第一章 MyBatis入门
本章将涵盖以下话题: ž MyBatis是什么? ž 为什么选择MyBatis? ž MyBatis安装配置 ž 域模型样例 1.1 MyBatis是什么 MyBatis是一个简化和实现了Ja ...