HorizontalScrollView和ScrollView简介

ScrollView和HorizontalScrollView都继承于FrameLayout组件,两个都是容器,前者为里面的组件添加竖直的滚动条,后者是水平的滚动条。

代码示例

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <HorizontalScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="hehhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"
                    android:textSize="60dp"/>

                </LinearLayout>
            </HorizontalScrollView>
        </ScrollView>

</LinearLayout>

效果图

Android的ScrollView和HorizontalScrollView-android学习之旅(四十一)的更多相关文章

  1. 开发了5年android,我开始了go学习之旅

    前言 做了近5年的android开发,最近项目也是不怎么忙,空闲的时候总会思考一些事情,不过作为移动开发,我个人觉得很有必要学习后台开发,由于公司是Go语言开发的,了解go语言一段时间后,我发现go语 ...

  2. Android下拉列表控件spinner-andoid学习之旅(十一)

    废话不多说,下拉列表常用的就是spinner控件. 直接上代码: package peng.liu.testview; import android.app.Activity; import andr ...

  3. Android列表视图ListView和ListActivity-android学习之旅(二十四)

    ListView简介 ListView是android中常用的一种控件,创建ListView有两种方式: 1.在xml中使用ListView控件创建. 2.使用activity继承ListActivi ...

  4. Android的ViewAnimator及其子类ViewSwitcher-android学习之旅(三十三)

    ViewAnimator继承了FrameLayout,多个组件重合在一起,可以加入多个组件,然后切换的时候会有动画. ViewAnimator及其子类的继承关系 ViewAnimator常用属性 Vi ...

  5. Android中scrollview嵌套HorizontalScrollView卡顿现象解决

    开发中经验会遇到滑动里面嵌入滑动的问题,但是这种情况下触摸事件就会发生冲突.导致滑动非常卡,甚至出现程序停止响应.这种情况下我们一般需要重写view.下面给出重新scrollview的方法 publi ...

  6. Dynamic CRM 2013学习笔记(四十一)流程4 - 异步工作流(Workflow)用法图解

    在CRM 2013 里,工作流被分成二类:异步工作流和实时工作流.异步工作流依赖一个windows 服务: Microsoft Dynamics CRM Asynchronous Processing ...

  7. Python学习笔记(四十一)— 内置模块(10)urllib

    摘抄自:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432688314 ...

  8. [原创] zabbix学习之旅四:mail客户端安装

    相信大家使用zabbix的最主要目的就是当被监控机器发生故障时,能通过zabbix获得第一时间的报警提醒.zabbix常用的报警媒介有email,短信,jabber和脚本,这其中脚本类型最为灵活,尤其 ...

  9. Python学习之旅(十一)

    Python基础知识(10):函数(Ⅱ) 一.全局变量和局部变量 局部变量:在函数内定义的变量,在函数内使用 全局变量:在函数外定义的变量,在程序任何地方都可以使用 1.全局变量与局部变量同名 这时函 ...

  10. Spring学习之旅(四)--高级装配Bean

    条件化 bean 有时候我们要满足某种情况才将bean 初始化放入容器中. 基于环境初始化不同的 bean 1.申明接口并创建两个实现类 public interface Teacher { void ...

随机推荐

  1. [bzoj1143][CTSC2008]祭祀

    题意:给定一个n个点m条边的有向无环图,你要选出最多的点,并且满足任意两点之间都不存在通路.2)输出每个点选了它之后还是否有最优解.   n<=100 m<=1000 题解:每个点拆两个点 ...

  2. 毕业回馈-89C51之GPIO使用(流水灯)

    今天分享一个89c51制作的8位流水灯案例.使用Proteus仿真. 同上一遍文章不同.上一篇文章中对于GPIO操作主要是位操作,即sbit led1=P0^0;其中P0^0代表p0.0这个引脚,然后 ...

  3. windows server 2003 远程桌面最大连接数调整与windows 2008远程桌面后,本地帐号自动锁定

    调整windows server 2003 最大远程连接数的步骤如下: 第1步.开始-->控制面板-->添加或删除程序-->添加/删除windows组件-->选择"终 ...

  4. 运行eclipse java virtual machine launcher 什么错误

    在MyEclipse的安装目录eclipse有个eclipse.ini文件原来的配置如下:-showsplashcom.genuitec.myeclipse.blue.product.ide--lau ...

  5. linux安装ftp

    安装vsftpd 1.以管理员(root)身份执行以下命令 1.  yum install vsftpd 2.设置开机启动vsftpd ftp服务 1.  chkconfig vsftpd on 3. ...

  6. bootmgr is missing 开机无法进系统怎么办

    认识 bootmgr: 启动管理器.Bootmgr是Boot Manager的缩写,是在Windows Vista和Windows 7中使用的新的启动管理器,以代替Windows xp中的启动管理器- ...

  7. 0. 迷之 -> 和 .

    0. 迷之 -> 和 . 箭头(->):左边必须为指针: 点号(.):左边必须为实体. e.g.1 class class A{ public: play(); }; int main() ...

  8. JAVA局部内部类

    在刚刚学到的android开发中了解到Button的onClick是通过局部内部类的方式实现的,具体的原理我以后再去了解,只是遇到问题总是想知道为什么,不要告诉我这是规则,死记住就可以了. 问题是局部 ...

  9. 创建OpenGL Context(WGL)

    创建OpenGL Context(WGL) 创建OpenGL Context是初始化OpenGL的一部分.只有在此之后才能使用OpenGL. 关于platform的注意事项 创建OpenGL cont ...

  10. Node.js 定时器

    稳定性: 5 - 锁定 所有的定时器函数都是全局的.不需要通过 require() 就可以访问. setTimeout(callback, delay[, arg][, ...]) delay 毫秒之 ...