本文是学习Android 开源项目源码解析 中 android-Ultra-Pull-To-Refresh 部分的笔记。原文:[http://a.codekk.com/detail/Android/Grumoon/android-Ultra-Pull-To-Refresh%20源码解析]
1 features
Download demo own experience, mainly drop-down refresh.
2. Overall design
First, two interfaces, functional interfaces and UI interfaces are abstracted.
PtrHandler 代表下拉刷新的功能接口,包含刷新功能回调方法以及判断是否可以下拉的方法。用户实现此接口来进行数据刷新工作。
Header 需要实现此接口,来处理下拉刷新过程中头部 UI 的变化。
The entire project revolves around the core class ptrframelayout. Ptrframelayout represents a drop-down refresh of the custom control.
Ptrframelayout inherits from ViewGroup and has only two sub-View, header header and content. Usually the Header implements the Ptruihandler interface, and Content can be any View.
As with all custom controls, Ptrframelayout determines the size and position of the control by overriding Onfinishinflate, Onmeasure, and OnLayout. The drop-down behavior of the control is determined by overriding the dispatchtouchevent.
Android-ultra-pull-to-refresh Learning