1.简介

当内容无法全部显示时,需要采取滚动的方式获取其与内容。其中,ScrollView为垂直滚动控件,HorizontalScrollView为水平滚动控件。

2.构建

XML代码:

<RelativeLayout 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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="example.scrollview.Activity1" >

<TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:gravity="center"
        android:text="@string/tv1" />

<ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="20dp" >

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

<TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="538dp"
                android:text="@string/tv2" />

</LinearLayout>
    </ScrollView>
</RelativeLayout>

Android开发--ScrollView的应用的更多相关文章

  1. Android开发ScrollView上下左右滑动事件冲突整理一(根据事件)

    主要通过重写 onInterceptTouchEvent 事件来解决,代码如下: package com.cm.android.pad.view.itemView; import android.co ...

  2. android 开发 ScrollView 控件的一些api描述与自定义ScrollView接口回调方法

    1.正常使用ScrollView控件的一些api详解. package com.example.lenovo.mydemoapp.scrollViewDemo; import android.supp ...

  3. Android开发:ScrollView嵌套GridView的解决办法

    Android开发:ScrollView嵌套GridView的解决办法   前些日子在开发中用到了需要ScrollView嵌套GridView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便 ...

  4. Android开发工程师文集-Fragment,适配器,轮播图,ScrollView,Gallery 图片浏览器,Android常用布局样式

    Android开发工程师文集-Fragment,适配器,轮播图,ScrollView,Gallery 图片浏览器,Android常用布局样式 Fragment FragmentManager frag ...

  5. android开发步步为营之65:解决ScrollView和ListView触摸事件onInterceptTouchEvent相互冲突问题

    近期项目里面有个需求,一个页面放了一个ScrollView,整个页面能够向上滚动,然后ScrollView里面又嵌套了一个ListView,ListView里面的数据也是能够上下滑动的,理论上List ...

  6. android 开发-ListView与ScrollView事件冲突处理(事件分发机制处理)

    ListView和ScrollView都存在滚动的效果,所以一般不建议listView和scrollView进行嵌套使用,但有些需求则需要用到两者嵌套.在android的学习中学了一种事件分发处理机制 ...

  7. 【Android】Android开发实现带有反弹效果,仿IOS反弹scrollview详解教程

    作者:程序员小冰,GitHub主页:https://github.com/QQ986945193 新浪微博:http://weibo.com/mcxiaobing 首先给大家看一下我们今天这个最终实现 ...

  8. Android开发之---Activity生命周期

    Android开发中,有四大组件:Activity.Service.Content Provider.Broadcast Receiver,可以说,activity的使用是最频繁的了,这里来梳理一下与 ...

  9. Android开发学习清单

    目录: 第1章 Android应用与开发环境1.1 Android的发展和历史1.1.1 Android的发展和简介1.1.2 Android平台架构及特性1.2 搭建Android开发环境1.2.1 ...

随机推荐

  1. MVC4中重复使用JQuery Mobile Dialog的做法实践.

    第一步:建立mobile项目类型 第二步:添加针对对话框的的DialogController.cs: 建立这个Controller的目的是此Dlg可以反复使用,把它做成一个固定界面,其他的Contro ...

  2. Node.js的核心与红利(zz)

    唯有明晰历史,才能了然当下,预知未来.作者从历史角度解读Node.js,帮助读者透过猜忌和谣言,看清真实的Node.js,了解Node.js的核心与红利. 令人惴惴不安的Node.js 我们越来越频繁 ...

  3. Leetcode: Split Array Largest Sum

    Given an array which consists of non-negative integers and an integer m, you can split the array int ...

  4. Java条件编译

    学习过C语言或者C++语言的同学都知道它们支持条件编译,那么今天我们来学习下在Java语言中如何实现条件编译.Java语言本身没有提供条件编译,但是Java编译器对.java文件编译为.class文件 ...

  5. C++之路进阶——codevs1319(玩具装箱)

    1319 玩具装箱  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond     题目描述 Description P教授要去看奥运,但是他舍不下他的玩具,于是 ...

  6. 免费的网络扫描器-Advanced IP Scanner

    软件会自动检测电脑所在的网段,自动决定扫描范围.(例如电脑IP是192.168.1.101,扫描范围就是192.168.1.*) 官方网站:http://www.advanced-ip-scanner ...

  7. MFC通过ODBC方式连接mysql

    一. 要安装mysql-connector-odbc驱动 二. 配置数据源 电脑的控制面板-管理工具-数据源ODBC-系统DSN-添加-选择刚刚安装的mysql odbc Driver 参考 http ...

  8. GWT入门学习之下载安装

    1.准备 安装 jdk: 下载路径:http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-windows-i586.exe?Aut ...

  9. 《C#编程》课件 - C#基础

    声明多维数组• 创建一个多维数组int[,] intMatrix;float[,] floatMatrix;string[,,] strCube;使用new关键字• 必须指定每个维度的大小int[,] ...

  10. HTTP中Get与Post的区别

    Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符,我们可以这样认 为:一个URL地址,它用于描述一个网络上的资源,而HTT ...