Android7.0中文文档(API)-- Scroller
来源:互联网 发布:关于茶的软件 编辑:程序博客网 时间:2024/06/02 06:47
完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/Scroller.html
Scroller
public class Scroller
extends Object
This class encapsulates scrolling. You can use scrollers (Scroller
orOverScroller
) to collect the data you need to produce a scrolling animation—for example, in response to a fling gesture. Scrollers track scroll offsets for you over time, but they don't automatically apply those positions to your view. It's your responsibility to get and apply new coordinates at a rate that will make the scrolling animation look smooth.
这个类封装了滚动行为。您可以使用滚动条(Scroller
或OverScroller
)来收集所需的数据,以生成滚动的动画,例如,对fling的手势进行响应。随着时间的推移,滚动条会为你跟踪滚动的偏移量,但它们不会自动将这些位置设置到你的视图中。你的责任是获取和设置新的坐标,以使滚动的动画看起来平滑。
Here is a simple example:
这里有个简单的例子:
private Scroller mScroller = new Scroller(context); ... public void zoomIn() { // Revert any animation currently in progress mScroller.forceFinished(true); // Start scrolling by providing a starting point and // the distance to travel mScroller.startScroll(0, 0, 100, 0); // Invalidate to request a redraw invalidate(); }
To track the changing positions of the x/y coordinates, use computeScrollOffset()
. The method returns a boolean to indicate whether the scroller is finished. If it isn't, it means that a fling or programmatic pan operation is still in progress. You can use this method to find the current offsets of the x and y coordinates, for example:
为了跟踪X/Y坐标的位置改变,请使用computeScrollOffset()
方法。该方法返回一个布尔值,以指示是否完成了滚动。如果不是这样,那就意味着一个fling或编程的操作仍然在进行中。你可以调用此方法来查找当前的X和Y坐标的偏移,例如:
if (mScroller.computeScrollOffset()) { // Get current x and y positions int currX = mScroller.getCurrX(); int currY = mScroller.getCurrY(); ...}
摘要
Public构造方法
Scroller(Context context)
Create a Scroller with the default duration and interpolator.
使用默认的持续时间和插值器来创建一个Scroller对象。
Scroller(Context context, Interpolator interpolator)
Create a Scroller with the specified interpolator.
使用指定的插值器来创建一个Scroller对象。
Scroller(Context context, Interpolator interpolator, boolean flywheel)
Create a Scroller with the specified interpolator.
使用指定的插值器来创建一个Scroller对象。
- Android7.0中文文档(API)-- Scroller
- Android7.0中文文档(API)--- FrameLayout
- Android7.0中文文档(API)--- DatePicker
- Android7.0中文文档(API) --- MediaController
- Android7.0中文文档(API)--- TabHost
- Android7.0中文文档(API) -- TimePicker
- Android7.0中文文档(API)-- ViewAnimator
- Android7.0中文文档(API)--- AbsoluteLayout
- Android7.0中文文档(API) -- Switch
- Android7.0中文文档(API) --- ToggleButton
- Android7.0中文文档(API) --- RadioButton
- Android7.0中文文档(API) --- CheckedTextView
- Android7.0中文文档(API) -- ScrollView
- Android7.0中文文档(API)-- DigitalClock
- Android7.0中文文档(API)-- TextClock
- Android7.0中文文档(API)---Chronometer
- Android7.0中文文档(API)--- AdapterView
- Android7.0中文文档(API)--- AdapterViewAnimator
- ShareUtil 工具类,用于SharedPreferences get,set数据
- app与后台的token、sessionId、RSA加密登录认证与安全解决方案
- 各个浏览器都是什么内核整理
- HADOOP集群搭建
- C++ SDL学习之路 1st —— 配置一下SDL
- Android7.0中文文档(API)-- Scroller
- 32. Longest Valid Parentheses
- 通过formdata ajax上传图片 以及后台接收formdata数据 mvc
- Android CPU架构解析
- 移动端UI尺寸
- Android进阶之路
- java nio教程(转)
- Mysql 水平拆分和垂直拆分
- 神经网络之激活函数