完整内容,请参考:http://www.zhdoc.net/android/reference/android/widget/EdgeEffect.html

EdgeEffect

public class EdgeEffect
extends Object

java.lang.Object
android.widget.EdgeEffect

This class performs the graphical effect used at the edges of scrollable widgets when the user scrolls beyond the content bounds in 2D space.
当用户滚动到二维空间中的内容边界时,该类将在可滚动控件边缘执行图形效果。

EdgeEffect is stateful. Custom widgets using EdgeEffect should create an instance for each edge that should show the effect, feed it input data using the methods onAbsorb(int), onPull(float), and onRelease(), and draw the effect using draw(Canvas) in the widget's overridden draw(Canvas) method. If isFinished() returns false after drawing, the edge effect's animation is not yet complete and the widget should schedule another drawing pass to continue the animation.
EdgeEffect是有状态的。使用EdgeEffect的自定义控件应该为每条边创建一个实例,该实例应该显示效果,使用onAbsorb(int)onPull(float)onRelease()来填充输入数据。并且在控件重载的draw(Canvas)方法中使用draw(Canvas)来绘制边缘。如果绘制后调用isFinished()返回false,则表明边缘效果的动画还没有完成,并且控件应该安排另一个绘制来继续这个动画。

When drawing, widgets should draw their main content and child views first, usually by invoking super.draw(canvas) from an overridden draw method. (This will invoke onDraw and dispatch drawing to child views as needed.) The edge effect may then be drawn on top of the view's content using the draw(Canvas) method.
绘制过程中,控件将首先绘制它们的主内容和子视图,通常通过从重载的draw方法中调用super.draw(canvas)。(这将调用onDraw,并根据需要派发绘制给子视图。)然后可以使用draw(Canvas)方法在视图的内容顶层绘制边缘效果。

摘要

Public构造方法

EdgeEffect(Context context)

Construct a new EdgeEffect with a theme appropriate for the provided context.
使用提供的上下文中合适的theme,来创建一个新的EdgeEffect对象。

Public方法

boolean draw(Canvas canvas)

Draw into the provided canvas.
绘制在提供的canvas中。

void finish()

Immediately finish the current animation.
立即完成当前动画。

int getColor()

Return the color of this edge effect in argb.
返回此边缘效果的颜色(argb格式)。

int getMaxHeight()

Return the maximum height that the edge effect will be drawn at given the original input size.
返回最大高度,在指定的原始input size上,边缘效果将被绘制出来。

boolean isFinished()

Reports if this EdgeEffect's animation is finished.
返回此EdgeEffects的动画是否已经完成。

void onAbsorb(int velocity)

Call when the effect absorbs an impact at the given velocity.
当这种效果会在指定的速度下接收一个fling动作时,调用此方法。

更多相关文章

  1. Android(安卓)Studio矢量图Vector Drawable绘制
  2. Android定义宽高比控件
  3. Android(安卓)控件GridView使用案例讲解
  4. android中的基本控件
  5. Android(安卓)布局 LinearLayout与RelativeLayout的布局属性
  6. ToggleButton
  7. Android(安卓)TextView 文字居中
  8. Android(安卓)ListView 去除边缘阴影、选中色、拖动背景色等
  9. android 配置属性

随机推荐

  1. 【Android】安卓常见的内存泄漏:OOM,bitmap
  2. 两种android app调用jar的方法
  3. Android(安卓)4.4(KitKat)窗口管理子系统
  4. android:screenOrientation属性
  5. Android中数据存储----SQLite数据库
  6. Android应用框架之应用启动过程
  7. MacBook下配置android adb命令使用环境
  8. android四大组件--ContentProvider详解
  9. 在android studio中导入cocos2dx中的andr
  10. Android之网络请求4————OkHttp源码1: