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 ...
随机推荐
- 新版Eclipse使用遇到的问题总结
1.SDK下载很慢. 配置SDK代理,速度像飞一样.建议先把20-24下完,不然后面遇到很多问题. 2.support-v7的问题 例如res\values\styles.xml:4: error: ...
- leetcode341
数据结构设计类题目,参考网上的代码: /** * // This is the interface that allows for creating nested lists. * // You sh ...
- 教你用一行Python代码实现并行(转)
教你用一行Python代码实现并行 本文教你通过一行Python实现并行化. Python在程序并行化方面多少有些声名狼藉.撇开技术上的问题,例如线程的实现和GIL,我觉得错误的教学指导才是主要问题. ...
- linux下使用adb查看android手机的logcat
root@ubuntu:/home/song# adb logcat -s VLC
- README.md的编写
1.编辑README文件 大标题(一级标题):在文本下面加等于号,那么上方的文字就变成了大标题,等于号的个数无限制,但一定要大于0 大标题 ==== 中标题(二级标题):在文本下面加下划线,那么上方的 ...
- Python列表的生成
要生成list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],我们可以用range(1, 11): >>> range(1, 11) [1, 2, 3, 4, 5, ...
- 148. Sort List (List)
Sort a linked list in O(n log n) time using constant space complexity. 法I:快排.快排的难点在于切分序列.从头扫描,碰到> ...
- 如何用shell脚本执行或关闭jar包服务?
现在springboot很流行,但是大家都知道springboot是以jar包的方式进行打包的,那样就少不了开启或关闭服务的操作了,但是命令方式未免过于繁琐. 下面记录shell脚本的方式启动或关闭服 ...
- winfrom 循环播放图片
没啥新东西了,就是遍历和匹配文件名然后获取对象,放到picturebox里面 选中listview中想要查看的图片,然后点击查看按钮,进行↓代码. if (listView1.SelectedItem ...
- 689. Maximum Sum of 3 Non-Overlapping Subarrays三个不重合数组的求和最大值
[抄题]: In a given array nums of positive integers, find three non-overlapping subarrays with maximum ...