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. Dedesql数据库类详解

    今天花点时间讲解下织梦的sql数据库类,近期本来是准备录制一套视频教程的,但由于视频压缩的问题迟迟没有开展工作,如果大家有什么好的视频压缩方式可以通过邮件的方式告诉我:tianya#dedecms.c ...

  2. Latent Dirichlet Allocation 文本分类主题模型

    文本提取特征常用的模型有:1.Bag-of-words:最原始的特征集,一个单词/分词就是一个特征.往往一个数据集就会有上万个特征:有一些简单的指标可以帮助筛选掉一些对分类没帮助的词语,例如去停词,计 ...

  3. boost源码剖析----boost::any

    boost源码剖析----boost::any 有的时候我们需要有一个万能类型来进行一些操作,这时候boost::any就派上用场了. boost::Any testInt(10); int val ...

  4. Elementory os install .net core

    ref link : https://www.microsoft.com/net/core#linuxubuntu sudo sh -c 'echo "deb [arch=amd64] ht ...

  5. 搭建android开发环境

    任何一个程序的开端都要从搭建开发环境开始,这样你就可以进行实战练习了,并且搭建完后即快速来一个项目HelloWorld, 哈哈,话不多说了,进入正题 android环境的安装主要分3步骤: 1.下载和 ...

  6. 移动web前端之meta标签

    最近这段时间忙着做web移动端,东西跟pc端还是有区别的.这个月也学到了不少东西,太多了就从头开始,先总结meta标签吧. 主要标签内容和注释如下: <meta charset="UT ...

  7. #添加图片,最多只能上传9张.md

    #添加图片,最多只能上传9张.md 前端页面: ```javascript <form id="imgForm" enctype="multipart/form-d ...

  8. Java 基础知识 问答

    1,Java为什么能跨平台运行?请简述原理. 因为Java程序编译之后的代码不是能被硬件系统直接运行的代码,而是一种“中间码”——字节码.然后不同的硬件平台上安装有不同的Java虚拟机(JVM),由J ...

  9. 【Redis】Redis的基本安装及使用

    在Linux上安装Redis Redis的安装很简单.基本上是下载.解压.运行安装脚本.我用的Redis版本是3.2.1. [nicchagil@localhost app]$ wget -q htt ...

  10. iOS 推送

    1,推送已至,点通知栏: a)若App在UIApplicationStateActive(活动)状态,调用 //接收到推送消息 - (void)application:(UIApplication * ...