页眉整体垂直方向滑动,xml文件较为简单,只需要在需要滑动的布局文件中包裹一层ScrollView就可以实现。

示例:

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

tools:context=".MainActivity"

tools:showIn="@layout/activity_main">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:scrollbars="none">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical"

app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintTop_toTopOf="parent">

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:layout_width="wrap_content"

android:layout_height="41dp"

android:layout_gravity="center_horizontal"

android:layout_marginTop="5dp"

android:layout_marginBottom="5dp"

android:text="Hello World!"

android:textSize="30sp"

android:textStyle="bold"

app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintLeft_toLeftOf="parent"

app:layout_constraintRight_toRightOf="parent"

app:layout_constraintTop_toTopOf="parent" />

android:id="@+id/button1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button1" />

android:id="@+id/button2"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button2" />

android:id="@+id/button3"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button3" />

android:id="@+id/button4"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button4" />

android:id="@+id/button5"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/button5" />

android:id="@+id/imageView"

android:layout_width="match_parent"

android:layout_height="251dp"

android:layout_gravity="center_horizontal"

android:contentDescription="@string/imageDesc" />

android:id="@+id/videoView"

android:layout_width="match_parent"

android:layout_height="251dp"

android:layout_gravity="center_horizontal" />

android:layout_width="match_parent"

android:layout_height="20dp">

android:layout_width="match_parent"

android:layout_height="wrap_content" />

如果scrollview中的布局文件可以在一个屏幕中完全显示出来,就没有滑动效果,如果不能,那么就可以上下滑动屏幕显示布局。

android 页面整体滑动,ScrollView 实现页面整体滑动相关推荐

  1. Android之解决在scrollview中嵌套ListView切换界面时scrollview整体向下滑动

    有时候我们在scrollview中会嵌套ListView,在嵌套ListView(ListView上面还有一些控件)后,切换Activity时会发现整个 scrollview 被向下滑动直到ListV ...

  2. android 滑动缩放监听,基于Android的ViewPager动画特效实现页面左右滑动效果(实现缩放...

    基于Android的ViewPager动画特效实现页面左右滑动效果(实现缩放 基于Android的ViewPager动画特效实现页面左右滑动效果(实现缩放和透明效果) 在上一个项目的基础上做修改,项目 ...

  3. 前端页面添加灰色滤镜,使网页整体变灰

    前端页面添加灰色滤镜,使网页整体变灰 修改css样式 只需要在html的样式里面加一句代码 html,body,div,img{-webkit-filter: grayscale(100%);-moz ...

  4. Android 手势导航(从下往上滑动进入多任务页面)

    Android系统启动篇 1,<android系统启动流程简介> 2,<android init进程启动流程> 3,<android zygote进程启动流程> 4 ...

  5. Android viewPager2 + fragment 模拟微信首页2(滑动页面标签同步变化,点击标签滑动页面)

    可以实现的方式:BottomNavigationView 这里我们不使用BottomNavigationView,手动来写代码 先看一下效果 fragment + viewPager2模拟微信首页2( ...

  6. Android之解决ScrollView嵌套RecycleView导致滑动冲突或者显示不全的问题

    1 问题 ScrollView嵌套RecycleView导致滑动冲突或者显示不全的问题 2 解决办法 1).ScrollView替换成普通布局,然后RecycleView用的BaseMultiItem ...

  7. android仿今日头条个人中心页面

    android仿今日头条个人中心页面 效果图 实现步骤: 自定义ScrollView,添加一个反弹的动画 代码: package com.example.administrator.gerenzhon ...

  8. 基于Android Studio实现的集新闻页面+时钟页面+登录页面于一体的简单demo

    demo简介:三个主界面:新闻页面+时钟页面+登录页面,三个页面可以通过点击底部导航栏(总共三个导航栏,新闻.时间.我,未选中时是白色的,选中后是红色的)以及左右滑动进行页面切换. 新闻界面(该界面有 ...

  9. ios 平滑移动view_解决页面使用overflow: scroll在iOS上滑动卡顿的问题

    最近的一次开发中,使用到了overflow:scroll 属性来滑动div. 如果你对某个div或模块使用了overflow: scroll属性,在iOS系统的手机上浏览时,则会出现明显的卡顿现象. ...

最新文章

  1. 【Java】 链表的回文结构
  2. bzoj1588[HNOI2002]营业额统计——双向链表
  3. js中常用的对象—String的属性和方法
  4. 漫画:什么是 “并查集” ?
  5. python modbus控制plc_python Modbus基础
  6. HTML5 Web Worker的使用
  7. 半年全球网络安全入侵事件近千起,超19亿数据受影响
  8. tab控件的使用心得
  9. Georgia Tech - machine learning 学习笔记一
  10. xunsearch全文检索初体验
  11. 什么才是真正的价值?
  12. m2接口和nvme协议接口_B85主板有M.2接口吗?支持NVMe协议吗?
  13. [二维压缩] | 条件图像游程编码
  14. 几本适合嵌入式软件工程师阅读的电子入门书
  15. SIEBEL基础学习
  16. DBVisualizer导入excel数据
  17. 关于-O0、O1、O2、O3优化
  18. 2013年微软校园招聘笔试题
  19. 深度学习——提升模型泛化能力的方法
  20. 极客日报第83期:百度92年程序员因“篡改数据”被抓;运营商辟谣首批 5G 用户被抛弃;特斯拉回应上海工厂摄像头被入侵

热门文章

  1. 光滑噪声数据常用的方法_数据挖掘中常用的数据清洗方法
  2. linux 命令 kps,Linux顶级命令.内存使用情况
  3. 信号回勾产生的原因_燃气减压阀振动的原因及处理方案
  4. MySQL百万级/千万级数据存储解决方案
  5. 基于mysql搭建框架环境搭建_Maven+Spring+Spring MVC+MyBatis+MySQL,搭建SSM框架环境
  6. linux my.cnf基本参数,Linux中MySQL配置文件my.cnf参数说明
  7. 安卓手机小说阅读器_乐小说阅读器下载手机版-乐小说阅读器app下载安装
  8. oracle fnd file.log,OracleEBSWIP模块DebugLog收集方法
  9. MySQL 优化 —— ORDER BY 优化
  10. LeetCode算法入门- 3Sum -day9