Android(java)学习笔记51:ScrollView用法
1. 理论部分
(1)ScrollView和HorizontalScrollView是为控件或者布局添加滚动条
(2)上述两个控件只能有一个孩子,但是它并不是传统意义上的容器
(3)上述两个控件可以互相嵌套
(4)滚动条的位置现在的实验结果是:可以由layout_width和layout_height设定
(5)ScrollView用于设置垂直滚动条,HorizontalScrollView用于设置水平滚动条:需要注意的是,有一个属性是 scrollbars 可以设置滚动条的方向:但是ScrollView设置成horizontal是和设置成none是效果同,HorizontalScrollView设置成vertical和none的效果同。
代码实践:
1 <?xml version="1.0" encoding="utf-8"?> 2 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 3 android:id="@+id/mScrollView" 4 android:layout_width="fill_parent" 5 android:layout_height="wrap_content" 6 android:scrollbars="vertical" > 7 8 <LinearLayout 9 android:layout_width="fill_parent" 10 android:layout_height="wrap_content" 11 android:orientation="vertical" > 12 13 <LinearLayout 14 android:layout_width="fill_parent" 15 android:layout_height="fill_parent" 16 android:orientation="horizontal" > 17 18 <Button 19 android:id="@+id/openNetCard" 20 android:layout_width="wrap_content" 21 android:layout_height="wrap_content" 22 android:layout_weight="1" 23 android:text="打开无线网卡" /> 24 25 <Button 26 android:id="@+id/closeNetCard" 27 android:layout_width="wrap_content" 28 android:layout_height="wrap_content" 29 android:layout_weight="1" 30 android:text="关闭无线网卡" /> 31 32 <Button 33 android:id="@+id/checkNetCardState" 34 android:layout_width="wrap_content" 35 android:layout_height="wrap_content" 36 android:layout_weight="1" 37 android:text="检查网卡状态" /> 38 </LinearLayout> 39 40 <LinearLayout 41 android:layout_width="fill_parent" 42 android:layout_height="fill_parent" 43 android:orientation="horizontal" > 44 45 <Button 46 android:id="@+id/scan" 47 android:layout_width="wrap_content" 48 android:layout_height="wrap_content" 49 android:layout_weight="1" 50 android:text="扫描网络" /> 51 52 <Button 53 android:id="@+id/getScanResult" 54 android:layout_width="wrap_content" 55 android:layout_height="wrap_content" 56 android:layout_weight="1" 57 android:text="扫描结果" /> 58 </LinearLayout> 59 60 <LinearLayout 61 android:layout_width="fill_parent" 62 android:layout_height="fill_parent" 63 android:orientation="horizontal" > 64 65 <Button 66 android:id="@+id/connect" 67 android:layout_width="wrap_content" 68 android:layout_height="wrap_content" 69 android:layout_weight="1" 70 android:text="连接Wifi" /> 71 72 <Button 73 android:id="@+id/disconnect" 74 android:layout_width="wrap_content" 75 android:layout_height="wrap_content" 76 android:layout_weight="1" 77 android:text="断开Wifi" /> 78 79 <Button 80 android:id="@+id/checkNetWorkState" 81 android:layout_width="wrap_content" 82 android:layout_height="wrap_content" 83 android:layout_weight="1" 84 android:text="Wifi连接状态" /> 85 </LinearLayout> 86 87 <TextView 88 android:id="@+id/scanResult" 89 android:layout_width="fill_parent" 90 android:layout_height="wrap_content" /> 91 </LinearLayout> 92 93 </ScrollView>
布局图如下:
……
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
……
转载于:https://www.cnblogs.com/hebao0514/p/4579194.html
Android(java)学习笔记51:ScrollView用法相关推荐
- Java学习笔记5-1——多线程
目录 前言 核心概念 线程创建 继承Thread类 实现Runnable接口 上述两个方法小结 实现Callable接口 并发问题简介 静态代理模式 线程状态 线程停止(stop) 线程休眠(slee ...
- java学习笔记(五)----super用法,final用法,抽象类,接口
子类不会继承父类的构造方法,在子类的构造方法中可使用super(参数列表)调用父类的构造方法. class Person { String name; int age; public Pers ...
- java/android 设计模式学习笔记(1)--- 单例模式
前段时间公司一些同事在讨论单例模式(我是最渣的一个,都插不上嘴 T__T ),这个模式使用的频率很高,也可能是很多人最熟悉的设计模式,当然单例模式也算是最简单的设计模式之一吧,简单归简单,但是在实际使 ...
- java/android 设计模式学习笔记(1)---单例模式
前段时间公司一些同事在讨论单例模式(我是最渣的一个,都插不上嘴 T__T ),这个模式使用的频率很高,也可能是很多人最熟悉的设计模式,当然单例模式也算是最简单的设计模式之一吧,简单归简单,但是在实际使 ...
- Android Studio --- [学习笔记]TCP(第2弹)、GridView、ScrollView
说明 这篇主要接上一篇Android Studio - > [学习笔记]RadioButton.CheckBox.ImageView.ListView.TCP的三次握手 对上面回答的细解,并用J ...
- java/android 设计模式学习笔记(6)---适配器模式
这篇来介绍一下适配器模式(Adapter Pattern),适配器模式在开发中使用的频率也是很高的,像 ListView 和 RecyclerView 的 Adapter 等都是使用的适配器模式.在我 ...
- java/android 设计模式学习笔记(8)---桥接模式
这篇博客我们来介绍一下桥接模式(Bridge Pattern),它也是结构型设计模式之一.桥接,顾名思义,就是用来连接两个部分,使得两个部分可以互相通讯或者使用,桥接模式的作用就是为被分离了的抽象部分 ...
- java/android 设计模式学习笔记(3)---工厂方法模式
这篇来介绍一下工厂方法模式(Factory Method Pattern),在实际开发过程中我们都习惯于直接使用 new 关键字用来创建一个对象,可是有时候对象的创造需要一系列的步骤:你可能需要计算或 ...
- java/android 设计模式学习笔记(7)---装饰者模式
这篇将会介绍装饰者模式(Decorator Pattern),装饰者模式也称为包装模式(Wrapper Pattern),结构型模式之一,其使用一种对客户端透明的方式来动态的扩展对象的功能,同时它也是 ...
- 《Java学习笔记(第8版)》学习指导
<Java学习笔记(第8版)>学习指导 目录 图书简况 学习指导 第一章 Java平台概论 第二章 从JDK到IDE 第三章 基础语法 第四章 认识对象 第五章 对象封装 第六章 继承与多 ...
最新文章
- oracle学习总结二(转义字符)
- Redux系列01:从一个简单例子了解action、store、reducer
- 数据库入门基本操作1
- 3个Gmail 邀请,先进先出!!
- 几个大厂及 RCE漏洞二三事
- 单源最短路径的Bellman-Ford算法。
- windows 下安装linux子系统及其可视化【Linux】
- 网易云 计算机,网易云音乐电脑版2.7.4.198336_网易云音乐 - 系统之家
- 基于单片机的KTV智能调光系统设计
- Excel知识技能汇总
- 我不要我觉得,我要你觉得--如何根据企业研发的现状实施DevOps
- 解决Visio中对象不能通过键盘方向键微调位置
- 正版-WPS下载地址(免费)
- java在深圳找工作_[深圳java求职]没经验 找工作 求指点
- 实现HTML转PDF 多个PDF合并
- 生存分析第一课: censoring 、truncation、survival function、hazard function
- 探讨关于Flash Player的更多线索(22.12.28更新)
- Canvas学习笔记及像素操作——实现马赛克
- 如何保护您的域名系统免遭劫持
- 四、Solr数据源配置(JNDI、DIH)及定时重做索引
热门文章
- C++ 单元测试框架 Boost Test BOOST_AUTO_TEST_CASE
- 前端----HTML
- Vuforia3D模型上传
- js中setTimeout()方法使用和窗口加载
- 提前观摩打二字计算机英语,英语口语国赛规划.doc
- javascript 面向对象的理解、数据属性的特征,基本数据类型、三大引用类型,方法
- 六、Oracle学习笔记:字符串函数
- 程序员需要了解依赖冲突的原因以及解决方案
- go lang go get There is no tracking information for the current branch.Please specify which
- PHP PDO(mysql) 封装类