【Scroller】scrollTo scrollBy startScroll computeScroll 自定义ViewPage 简介 示例
简介
构造函数
- Scroller(Context context):Create a Scroller with the default duration and interpolator.
- Scroller(Context context, Interpolator interpolator):interpolator参数只是在computeScrollOffset()中用于对我们的流逝的时间(通过timePassed()取得)这值进行重新解析。If the interpolator is null, the default (viscous) interpolator will be used. "Flywheel" behavior will be in effect for apps targeting Honeycomb or newer.
- Scroller(Context context, Interpolator interpolator, boolean flywheel):Specify指定 whether or not to support progressive "flywheel" behavior in flinging.
公共函数
- void abortAnimation() 停止scroll。Stops the animation.
- boolean computeScrollOffset():计算scroll的情况,判断滚动操作是否已经完成了。Call this when you want to know the new location. If it returns true,the animation is not yet finished.
- void extendDuration(int extend):增加scroll的时间。Extend the scroll animation. This allows a running animation to scroll further and longer, when used with setFinalX(int) orsetFinalY(int).
- void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY):模拟fling形式的scroll行为。int startX, int startY 代表起点,int velocityX, int velocityY代表初速度,int minX, int maxX, int minY, int maxY代表终点的范围
- final void forceFinished(boolean finished):强制设置为scroll状态。Force the finished field to a particular特定的 value.
- float getCurrVelocity():得到当前速度。该值是X方向和Y方向的合成值。Returns the current velocity. Return the original velocity less the deceleration减速. Result may be negative负值.
- final int getCurrX():得到当前的X坐标。Returns the current X offset in the scroll.
- final int getDuration():得到设置的scroll行为的总时间值。Returns how long the scroll event will take, in milliseconds.
- final int getFinalX():得到scroll行为终点的X值。Returns where the scroll will end.
- void setFinalX(int newX):设置scroll行为的终点的X值。Sets the final position (X) for this scroller.
- final int getStartX():得到scroll行为起点的X值。Returns the start X offset in the scroll.
- final boolean isFinished():返回scroll行为是否结束。Returns whether the scroller has finished scrolling.True if the scroller has finished scrolling, false otherwise.
- boolean isScrollingInDirection(float xvel, float yvel):这是一个public类型的hide方法
- final void setFriction(float friction):设置摩擦力。The amount of friction applied to flings. The default value is ViewConfiguration的getScrollFriction.
- void startScroll(int startX, int startY, int dx, int dy):设置一个scrolling行为模型,即在默认时间(250毫秒)内从int startX, int startY 这个点起向X和Y方向分别滚动 int dx 和 int dy 个像素。Start scrolling by providing a starting point and the distance距离 to travel.
- void startScroll(int startX, int startY, int dx, int dy, int duration):指定时间
- int timePassed():从scroll开始到现在已经过去的时间。其值为 AnimationUtils.currentAnimationTimeMillis() - mStartTime。Returns the time elapsed消逝、过去 since the beginning of the scrolling.
View与Scroller的关系
/**
* Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
* This will typically通常 be done if the child is animating a scroll在滚动 using a Scroller object.
*/
public void computeScroll() {
}
示例代码
}
【Scroller】scrollTo scrollBy startScroll computeScroll 自定义ViewPage 简介 示例的更多相关文章
- Android scrollTo() scrollBy() Scroller解说及应用
版本号:1.0 日期:2014.6.17 2014.6.18 版权:© 2014 kince 转载注明出处 scrollTo() .scrollBy()及 Scroller在视图滑动中常常使用 ...
- 图解Android View的scrollTo(),scrollBy(),getScrollX(), getScrollY()
https://blog.csdn.net/bigconvience/article/details/26697645 Android系统手机屏幕的左上角为坐标系,同时y轴方向与笛卡尔坐标系的y轴方向 ...
- View:Android View的scrollTo(),scrollBy(),getScrollX(), getScrollY()的理解
Android系统手机屏幕的左上角为坐标系,同时y轴方向与笛卡尔坐标系的y轴方向想反.提供了 getLeft(), getTop(), getBottom(), getRight() 这些API来获取 ...
- MVC中自定义ViewPage和WebViewPage
ViewPage和WebViewPage的作用就是将Controller中数据返回给页面,一个是针对aspx一个相对cshtml的.代码如下: public abstract class WebVie ...
- ivew数控件Tree自定义节点内容示例分析
ivew数控件Tree自定义节点内容示例分析 demo地址:https://run.iviewui.com/plcWlM4H <template> <Tree :data=" ...
- scrollTo , scrollBy区别
View视图中scrollTo 与scrollBy这两个函数的区别 . 首先 ,我们必须明白在Android View视图是没有边界的,Canvas是没有边界的,只不过我们通过绘制特定的View时对 ...
- getX,getY,getScrollX,getScrollY,ScrollTo(),ScrollBy()辨析
前言:前两天看了自定义控件,其中有一些东西我觉得有必要深入理解一下 以下图为例: getX(),getY()返回的是触摸点A相对于view的位置 getRaw(),getRawY()返回的是触摸点B相 ...
- Salesforce自定义权限简介
自定义权限(Custom Permission) Salesforce默认提供了多种方式设定用户的权限,比如简档.权限集等.在这些设定中,已经包括了系统中的对象.应用.字段.页面布局等组件,管理员或开 ...
- [转][Java]自定义标签简介
作用:自定义标签主要用于移除 jsp 页面中的 java 代码. 实现:需要完成以下两个步骤: 编写一个实现 Tag 接口的 Java 类,把页面 java 代码移到这个 java 类中.(标签处理类 ...
随机推荐
- LoadRunner学习笔记log函数
lr_log_message 只是记会写到本地vuser的log里面. lr_message和lr_output_message基本相同,它们会同时写到vuser的log和发送到controller里 ...
- centos7 lamp环境搭建
一.安装Apache1.安装yum -y install httpd2.开启apache服务systemctl start httpd.service3.设置apache服务开机启动systemctl ...
- 几类javascript常用的创建对象方法
JavaScript的一个重要功能就是面向对象的功能,通过基于对象的程序设计,可以用更直观.模块化和可重复使用的方式进行程序开发. 一组包含数据的属性和对属性中包含数据进行操作的方法,称为对象.比如要 ...
- powershell 获取 CPU 物理 / 逻辑核心数
转载请注明: 仰望高端玩家的小清新 http://www.cnblogs.com/luruiyuan/ 获取 CPU 逻辑核心数的方法为:总逻辑核心数 = 物理核心数 * 每核逻辑核心数 其中 ...
- Trie树入门
Trie树入门 貌似很多人会认为\(Trie\)是字符串类型,但是这是数据结构!!!. 详情见度娘 下面开始进入正题. PS:本文章所有代码未经编译,有错误还请大家指出. 引入 先来看一个问题 给 ...
- 【JAVAWEB学习笔记】19_事务概述、操作、特性和隔离级别
事务 学习目标 案例-完成转账 一.事务概述 1.什么是事务 一件事情有n个组成单元 要不这n个组成单元同时成功 要不n个单元就同时失败 就是将n个组成单元放到一个事务中 2.mysql的事务 默认的 ...
- TCP/IP——IP网络协议简记
IP提供不可靠.无连接的数据报传送服务 不可靠:不保证IP数据报能成功到达目的地,当发生错误时,IP的做法是丢弃这个数据报,然后发送ICMP消息报给信息源. 无连接:IP不维护任何关于后续数据报的状态 ...
- iOS 9应用开发基础教程下册
iOS 9应用开发基础教程下册 介绍: 本教程是国内第一本iOS 9开发应用教程.本教程基于Xcode 7.0,使用Swift 2.0语言讲解如何开发iOS 9的应用App. 学习建议:本教程针对 ...
- Opencv学习笔记1:安装opencv和VS2015并进行环境配置
用了Opencv一段时间了,简单记录一下opencv在vs2015下的配置. 第一部分:OpenCV3.2.0的下载 OpenCV官方下载地址: https://opencv.org/releases ...
- DEDECMS最新友情链接getshell漏洞分析
先上exp: <?php //print_r($_SERVER); $referer = $_SERVER['HTTP_REFERER']; $dede_login = str_replace( ...