您的位置:首页 > 移动开发 > Android开发

Android HorizontalScrollView

2014-03-07 16:14 417 查看
今天了看了下 HorizontalScrollView 这个类,里面发现了几个好玩的东西,比如:

private OverScroller mScroller;

我印象中,有个Scroller,但是不知道还有个OverScroller,下面是这个类的解释:

/**
* This class encapsulates scrolling with the ability to overshoot the bounds
* of a scrolling operation. This class is a drop-in replacement for
* {@link android.widget.Scroller} in most cases.
*/

    private EdgeEffect mEdgeGlowLeft;

看类的命名应该是“边缘效果”,查了下,才知道,原来是,比如listview,滑动到顶部的时候,拉不动了,但是有个反色,android原生系统的话,会看的特别清楚。

因为最近一直在学习View的滑动,Scroller,什么的,今天看到 HorizontalScrollView,觉得这个类对于学习自定义View简直太有用了,很多地方写的非常好,我要好好学习下这个类~

还有一个发现:在ViewGroup中类的开始说明如下,只截取了我要说明的部分:

<p>Here is a complete implementation of a custom ViewGroup that implements
* a simple {@link android.widget.FrameLayout} along with the ability to stack
* children in left and right gutters.</p>
*
* {@sample development/samples/ApiDemos/src/com/example/android/apis/view/CustomLayout.java
* Complete}
*
* <p>If you are implementing XML layout attributes as shown in the example, this is the
* corresponding definition for them that would go in <code>res/values/attrs.xml</code>:</p>
*
* {@sample development/samples/ApiDemos/res/values/attrs.xml CustomLayout}
*
* <p>Finally the layout manager can be used in an XML layout like so:</p>
*
* {@sample development/samples/ApiDemos/res/layout/custom_layout.xml Complete}

在Android4.4的ViewGroup代码中,在ApiDemos中已经加入了一个完全实现ViewGroup的例子,如果想学习自定义ViewGroup,可以看看这个例子~

参考链接:

OverScroller
http://developer.android.com/reference/android/widget/OverScroller.html http://blog.csdn.net/zouxueping/article/details/6832805 http://www.zjapk.com/thread-3893-1-1.html http://linkyan.com/2013/06/animating-scroll-gesture/ http://stackoverflow.com/questions/20329018/android-overscroller-and-performance http://www.cnblogs.com/vus520/archive/2011/11/29/2561951.html
EdgeEffect
http://blog.csdn.net/sunny2come/article/details/9820719
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android4.4