如何使用pulltozoompullrefreshlistvieww

1021人阅读
Demo测试(23)
&&& 前段时间,在使用ListView的过程中突然发现PullToRefresh的使用方法,用于上拉下拉刷新使用,觉得该方法很好使用,特此分享,供大家参考。
&&& 由于PullToRefresh方法是开源的第三方插件使用,所以使用步骤如下:
1、在GitHub上面下载源码以及需使用的包,地址为,将library文件夹引用至自己的工作项目。(再此不做详细的导入说明)
2、导入完成之后,就可以开始编写自己的xml文件,具体代码如下。
注意:为了使用PullToRefresh一些属性,需要引命名空间,因此
xmlns:ptr = &/apk/res-auto&
ptr:ptrMode=&both&
该两行代码不能省略。
&LinearLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:orientation=&vertical&
android:background=&@color/bg&
tools:context=&.MainActivity&&
&com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:ptr = &/apk/res-auto&
android:id=&@+id/pull_refresh_list&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:dividerHeight=&1dp&
android:fadingEdge=&none&
android:fastScrollEnabled=&false&
android:footerDividersEnabled=&false&
android:headerDividersEnabled=&false&
android:smoothScrollbar=&true&
android:focusableInTouchMode=&true&
android:focusable=&true&
ptr:ptrMode=&both&/&
&/LinearLayout&
3、编写java文件,具体代码如下。
package pulltorefresh.
import android.app.A
import android.content.pm.ActivityI
import android.os.AsyncT
import android.os.B
import android.view.V
import android.widget.AdapterV
import android.widget.AdapterView.OnItemLongClickL
import android.widget.ArrayA
import android.widget.ListV
import android.widget.T
import com.handmark.pulltorefresh.library.PullToRefreshB
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2;
import com.handmark.pulltorefresh.library.PullToRefreshListV
import java.util.A
import java.util.LinkedL
* PullToRefresh
* write by jimmy.li
public class MainActivity extends Activity {
private LinkedList&String& mListI
private PullToRefreshListView mPullRefreshListV
private ArrayAdapter&String& mA
private int mDowmAddNum = 1;
private int mUpAddNum = 1;
//每次刷新增加5个listItem
private int mAddFalg = 5;
private String[] mStrings = {&Jimmy1&, &Jimmy2&, &Jimmy3&, &Jimmy4&, &Jimmy5&,
&Jimmy6&, &Jimmy7&, &Jimmy8&, &Jimmy9&, &Jimmy10&, &Jimmy11&, &Jimmy12&,
&Jimmy13&, &Jimmy14&, &Jimmy15&, &Jimmy16&, &Jimmy17&, &Jimmy18&, &Jimmy19&,
&Jimmy20&, &Jimmy21&, &Jimmy22&, &Jimmy23&, &Jimmy24&, &Jimmy25&, &Jimmy26&};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
initData();
private void initData() {
* 实现 接口
OnRefreshListener2&ListView&
以便与监听
滚动条到顶部和到底部
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener2&ListView&() {
//onPullDownToRefresh
public void onPullDownToRefresh(PullToRefreshBase&ListView& refreshView) {
Toast.makeText(MainActivity.this, &onPullDownToRefresh&, Toast.LENGTH_SHORT).show();
for (int i = 1; i &= mAddF i++) {
mListItems.addFirst(&Added Later refresh...& + mDowmAddNum);
mDowmAddNum++;
new GetDataTask().execute();
//onPullUpToRefresh
public void onPullUpToRefresh(PullToRefreshBase&ListView& refreshView) {
Toast.makeText(MainActivity.this, &onPullUpToRefresh&, Toast.LENGTH_SHORT).show();
for (int i = 1; i &= mAddF i++) {
mListItems.addLast(&Added after refresh...& + mUpAddNum);
mUpAddNum++;
new GetDataTask().execute();
//获取控件并注册
ListView actualListView = mPullRefreshListView.getRefreshableView();
registerForContextMenu(actualListView);
mListItems = new LinkedList&String&();
mListItems.addAll(Arrays.asList(mStrings));
//设置适配器
mAdapter = new ArrayAdapter&String&(this, android.R.layout.simple_list_item_1, mListItems);
actualListView.setAdapter(mAdapter);
private void initUI() {
mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
//模拟网络加载数据的
异步请求类
private class GetDataTask extends AsyncTask&Void, Void, String[]& {
//子线程请求数据
protected String[] doInBackground(Void... params) {
// Simulates a background job.
Thread.sleep(1000);
} catch (InterruptedException e) {
//主线程更新UI
protected void onPostExecute(String[] result) {
mAdapter.notifyDataSetChanged();
// Call onRefreshComplete when the list has been refreshed.
mPullRefreshListView.onRefreshComplete();
super.onPostExecute(result);
4、主要代码讲解。
private void initData() {
* 实现 接口
OnRefreshListener2&ListView&
以便与监听
滚动条到顶部和到底部
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener2&ListView&() {
//onPullDownToRefresh
public void onPullDownToRefresh(PullToRefreshBase&ListView& refreshView) {
Toast.makeText(MainActivity.this, &onPullDownToRefresh&, Toast.LENGTH_SHORT).show();
for (int i = 1; i &= mAddF i++) {
mListItems.addFirst(&Added Later refresh...& + mDowmAddNum);
mDowmAddNum++;
new GetDataTask().execute();
//onPullUpToRefresh
public void onPullUpToRefresh(PullToRefreshBase&ListView& refreshView) {
Toast.makeText(MainActivity.this, &onPullUpToRefresh&, Toast.LENGTH_SHORT).show();
for (int i = 1; i &= mAddF i++) {
mListItems.addLast(&Added after refresh...& + mUpAddNum);
mUpAddNum++;
new GetDataTask().execute();
上面主要是利用initData()函数将PullToRefresh上拉下拉刷新的主要代码封装起来,分别对应其下拉和上拉事件监听器。
//获取控件并注册
ListView actualListView = mPullRefreshListView.getRefreshableView();
registerForContextMenu(actualListView);
mListItems = new LinkedList&String&();
mListItems.addAll(Arrays.asList(mStrings));
//设置适配器
mAdapter = new ArrayAdapter&String&(this, android.R.layout.simple_list_item_1, mListItems);
actualListView.setAdapter(mAdapter);
上面代码主要是获取ListView空间并实行注册,并设置适配器以显示ListView。
Good luck!
Write by Jimmy.li

&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:48969次
排名:千里之外
原创:39篇
(2)(2)(6)(1)(5)(4)(14)(5)  下拉刷新是很多应用都使用的很流行的一种效果,今天也算是彻底的理解了一下PullToRefreshListView的使用,但是弄了一天却在一个很傻的地方犯了错误。
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.news_items, null);
holder = new ViewHolder();
holder.newsImage = (ImageView) convertView.findViewById(R.id.news_image);
holder.titleTextView = (TextView) convertView.findViewById(R.id.news_title);
convertView.setTag(holder);
holder = (ViewHolder) convertView.getTag();
News news = newses.get(position);
if (news != null) {
holder.titleTextView.setText(newses.get(position).getTitle());
AVFile avFile = newses.get(position).getAVFile("image");
if (avFile == null) {
Logger.d("该条新闻的图片没有");
if (avFile != null) {
String url = avFile.getUrl();
//显示图片的配置
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnFail(R.drawable.healthy_icon01)
.showImageForEmptyUri(R.drawable.healthy_icon01)
.showImageOnLoading(R.drawable.healthy_icon01)
.cacheInMemory(true)
.cacheOnDisk(true)
.displayer(new SimpleBitmapDisplayer())
.bitmapConfig(Bitmap.Config.RGB_565)
ImageLoader.getInstance().displayImage(url, holder.newsImage, options);
return convertV
static class ViewHolder{
ImageView newsI
TextView titleTextV
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null){
view = LayoutInflater.from(context).inflate(R.layout.healthy_item,null);
view = convertV
TextView healthy_title = (TextView) view.findViewById(R.id.healthy_title);
healthy_title.setText(healthyList.get(position).getTitle());
我犯的错误是将TextView healthy_title = (TextView) view.findViewById(R.id.healthy_title);healthy_title.setText(healthyList.get(position).getTitle());这段代码写在了第一个if判断中,导致的结果就是如果covertView为空时,标题可以正常在页面上显示,一旦直接加入缓存时,标题就无法正常显示,就会出现很奇怪的错误,ListView中的标题各种错乱,其实应该在就可以想到是BaseAdapter中的错误的,还好我有足够的时间去纠正错误并从中学习到很多知识。
关于PullToRefreshListView的使用网上有很多的博客都有介绍。基本绑定adapter之后,可以通过setRefreshing(),直接显示刷新的页面。之后就是setOnRefreshListener()来监听滑动的判断,可以设置PullToRefresh的mode来设置上滑刷新、下滑刷新。
public void onPullUpToRefresh(PullToRefreshBase&ListView& refreshView) {
//上滑刷新
//Toast.makeText(HealthyActivity.this,"上拉刷新",Toast.LENGTH_SHORT).show();
String label = DateUtils.formatDateTime(getApplicationContext(),
System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
// Update the LastUpdatedLabel
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(
"更新于" + " : " + label);
asyncHttpClient.get(nextPageUrl,new AsyncHttpResponseHandler() {
public void onSuccess(int i, Header[] headers, byte[] bytes) {
String str = new String(bytes,"gb2312");
Document document = Jsoup.parse(str);
Element body = document.body();
Elements tdWidth = body.select("td[width=500]");
Elements tdHeight = tdWidth.select("td[height=40]");
Elements links = tdHeight.select("a");
Log.d("hys",healthyList.toString());
for (Element link : links){
String title = link.text();
String url = link.attr("href");
healthy = new Healthy();
healthy.setTitle(title);
healthy.setUrl(url);
healthyList.add(healthy);
Iterator&Healthy& iterator = healthyList.iterator();
while (iterator.hasNext()){
Healthy healthy = iterator.next();
Log.d("hys","healthy1.getTitle() : "+healthy.getTitle());
HealthyAdapter healthyAdapter = new HealthyAdapter(HealthyActivity.this,healthyList);
healthyAdapter.notifyDataSetChanged();
pullToRefreshListView.onRefreshComplete();
Elements link_more = body.select("a[href^=.cn/system/more/]");
if (link_more.size() == 2){
nextPageUrl = link_more.get(1).attr("href");
else if (link_more.size() == 1){
nextPageUrl = link_more.get(0).attr("href");
}catch (IOException e){
Log.d("file read exception : ", e.getMessage());
public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
Toast.makeText(HealthyActivity.this, "请检查网络连接", Toast.LENGTH_SHORT).show();
Log.d("asyncHttpClient fail : ",throwable.getMessage());
&&& String label = DateUtils.formatDateTime(getApplicationContext(),System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);&&&&&&&&&&&&&&& refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(&&&&&&&&&&&&&&&&&&&&&&& "更新于" + " : " + label);
DateUtils是android.text.format包下的一个类,非常的好用,以后在时间方面可以多多使用这个方法。刷新结束必须healthyAdapter.notifyDataSetChanged();&&&&&&&&&&&&&&&&&&&&&&& pullToRefreshListView.onRefreshComplete();这两个方法,第一个用来提示数据加载完成,第二个表示刷新已经完成,刷新就会结束。另外在属性上可以对PullToRefreshListView进行属性上的定制,只要在xml文件中增加一个&xmlns:ptr="" 的命名空间即可。
&?xml version="1.0" encoding="utf-8"?&
&resources&
&declare-styleable name="PullToRefresh"&
&!-- A drawable to use as the background of the Refreshable View --&
&!-- 设置刷新view的背景 --&
&attr name="ptrRefreshableViewBackground" format="reference|color" /&
&!-- A drawable to use as the background of the Header and Footer Loading Views --&
&!-- 设置头部view的背景 --&
&attr name="ptrHeaderBackground" format="reference|color" /&
&!-- Text Color of the Header and Footer Loading Views --&
&!-- 设置头部/底部文字的颜色 --&
&attr name="ptrHeaderTextColor" format="reference|color" /&
&!-- Text Color of the Header and Footer Loading Views Sub Header --&
&!-- 设置头部/底部副标题的文字颜色 --&
&attr name="ptrHeaderSubTextColor" format="reference|color" /&
&!-- Mode of Pull-to-Refresh that should be used --&
&!-- 设置下拉刷新的模式,有多重方式可选。无刷新功能,从顶部刷新,从底部刷新,二者都有,只允许手动刷新 --&
&attr name="ptrMode"&
&flag name="disabled" value="0x0" /&
&flag name="pullFromStart" value="0x1" /&
&flag name="pullFromEnd" value="0x2" /&
&flag name="both" value="0x3" /&
&flag name="manualOnly" value="0x4" /&
&!-- These last two are depreacted --&
&!-- 这两个属性不推荐了,用上面的代替即可 --&
&flag name="pullDownFromTop" value="0x1" /&
&flag name="pullUpFromBottom" value="0x2" /&
&!-- Whether the Indicator overlay(s) should be used --&
&!-- 是否显示指示箭头 --&
&attr name="ptrShowIndicator" format="reference|boolean" /&
&!-- Drawable to use as Loading Indicator. Changes both Header and Footer. --&
&!-- 指示箭头的图片 --&
&attr name="ptrDrawable" format="reference" /&
&!-- Drawable to use as Loading Indicator in the Header View. Overrides value set in ptrDrawable. --&
&!-- 顶部指示箭头的图片,设置后会覆盖ptrDrawable中顶部的设置 --&
&attr name="ptrDrawableStart" format="reference" /&
&!-- Drawable to use as Loading Indicator in the Fooer View. Overrides value set in ptrDrawable. --&
&!-- 底部指示箭头的图片,设置后会覆盖ptrDrawable中底部的设置 --&
&attr name="ptrDrawableEnd" format="reference" /&
&!-- Whether Android's built-in Over Scroll should be utilised for Pull-to-Refresh. --&
&attr name="ptrOverScroll" format="reference|boolean" /&
&!-- Base text color, typeface, size, and style for Header and Footer Loading Views --&
&!-- 设置文字的基本字体 --&
&attr name="ptrHeaderTextAppearance" format="reference" /&
&!-- Base text color, typeface, size, and style for Header and Footer Loading Views Sub Header --&
&!-- 设置副标题的基本字体 --&
&attr name="ptrSubHeaderTextAppearance" format="reference" /&
&!-- Style of Animation should be used displayed when pulling. --&
&!-- 设置下拉时标识图的动画,默认为rotate --&
&attr name="ptrAnimationStyle"&
&flag name="rotate" value="0x0" /&
&flag name="flip" value="0x1" /&
&!-- Whether the user can scroll while the View is Refreshing --&
&!-- 设置刷新时是否允许滚动,一般为true --&
&attr name="ptrScrollingWhileRefreshingEnabled" format="reference|boolean" /&
Whether PullToRefreshListView has it's extras enabled. This allows the user to be
able to scroll while refreshing, and behaves better. It acheives this by adding
Header and/or Footer Views to the ListView.
&!-- 允许在listview中添加头/尾视图 --&
&attr name="ptrListViewExtrasEnabled" format="reference|boolean" /&
Whether the Drawable should be continually rotated as you pull. This only
takes effect when using the 'Rotate' Animation Style.
&!-- 当设置rotate时,可以用这个来设置刷新时旋转的图片 --&
&attr name="ptrRotateDrawableWhilePulling" format="reference|boolean" /&
&!-- BELOW HERE ARE DEPRECEATED. DO NOT USE. --&
&attr name="ptrAdapterViewBackground" format="reference|color" /&
&attr name="ptrDrawableTop" format="reference" /&
&attr name="ptrDrawableBottom" format="reference" /&
&/declare-styleable&
&/resources&
最后完成了从网页读取信息,展示在手机上的效果,并且完善了之前功能的下拉刷新部分。不过对于html的文本在android设备图片显示的问题依然没有得到非常完美的解决办法。实在无法处理网页中的图片在Andorid设备上的布局和大小,希望之后能获得一个完美的解决方案。
阅读(...) 评论()> 博客详情
& & 现在很多android应用程序,比如新浪微博,在联网刷新内容时,都有一个滑动刷新的ListView,用户将内容下滑,就会有新的结果呈现。如下图所示:
上图中的功能是一个开源的项目android-pulltorefresh来实现的,我们可以利用这个项目来完成这个功能。
这个项目的源码托管在github上,地址为:
下面来介绍如何使用:
滑动刷新其实就用到一个类PullToRefreshListView,它是ListView的子类,相应用到的layout文件为也就是说要用滑动刷新,需要将上面的类和xml及一些图片下载下来放到自己的工程中调用。
我们在用到这个类的activity的layout中加上如下代码:
The PullToRefreshListView replaces a standard ListView widget.
&com.markupartist.android.widget.PullToRefreshListView
android:id="@+id/android:list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
在activity中加入下面的代码:
// Set a listener to be invoked when the list should be refreshed.
((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshListener() {
public void onRefresh() {
// Do work to refresh the list here.
new GetDataTask().execute();
private class GetDataTask extends AsyncTask&Void, Void, String[]& {
protected void onPostExecute(String[] result) {
mListItems.addFirst("Added after refresh...");
// Call onRefreshComplete when the list has been refreshed.
((PullToRefreshListView) getListView()).onRefreshComplete();
super.onPostExecute(result);
以上代码分别是设置刷新监听器和后台任务执行。
自己原来写了一个例子,不小心删除了,就不重写贴给大家了。
另外,个人感觉这个滑动现在不是很灵敏,有些卡。
人打赏支持
码字总数 41795
支付宝支付
微信扫码支付
打赏金额: ¥
已支付成功
打赏金额: ¥android(94)
listView 的headerView下拉刷新比较流行,比如商品列表中对品牌的介绍可以用到这个功能,体验感受了下PullToZoomInListView,
感觉比较好的效果,就拿来分析下。
PullToZoomInListView 是自定义了一个ListView,headerVIew的图片支持缩放,效果比较有美感,动画也比较流畅,是一个比较好的
其实PullToZoomListView的实现原理很简单
主要是在case MotionEvent.ACTION_MOVE:代码段中判断向下滑动的偏移量,根据这个来改变listview headerView内容
区域的高度,并且在手指放开的那一刻,停止缩放,启用一个动画来使HeaderView平滑的恢复到放大之前的状态。
1、首先初始化画布局init(Context paramContext),通过setHeaderViewSize(i, (int) (9.0F * (i / 16.0F)))设置header图片的大小,启动ScalingRunnalable线程;
2、初始化完成后,注册一个OnScrollListener监听,当滚动之后可以恢复到初始化的状态
public void onScroll(AbsListView paramAbsListView, int paramInt1,
int paramInt2, int paramInt3) {
Log.d(&mmm&, &onScroll&);
float f = this.mHeaderHeight - this.mHeaderContainer.getBottom();
Log.d(&mmm&, &f|& + f);
if ((f & 0.0F) && (f & this.mHeaderHeight)) {
Log.d(&mmm&, &1&);
int i = (int) (0.65D * f);
this.mHeaderImage.scrollTo(0, -i);
} else if (this.mHeaderImage.getScrollY() != 0) {
Log.d(&mmm&, &2&);
this.mHeaderImage.scrollTo(0, 0);
if (this.mOnScrollListener != null) {
this.mOnScrollListener.onScroll(paramAbsListView, paramInt1,
paramInt2, paramInt3);
3、拉动时候缩放,主要是在&MotionEvent.ACTION_MOVE:代码段中判断向下滑动的偏移量,
this.mHeaderContainer.getBottom() &= this.mHeaderHeight,图片下移,放大图片
case MotionEvent.ACTION_MOVE:
Log.d(&mmm&, &mActivePointerId& + mActivePointerId);
int j = paramMotionEvent.findPointerIndex(this.mActivePointerId);
if (j == -1) {
Log.e(&PullToZoomListView&, &Invalid pointerId=&
+ this.mActivePointerId + & in onTouchEvent&);
if (this.mLastMotionY == -1.0F)
this.mLastMotionY = paramMotionEvent.getY(j);
if (this.mHeaderContainer.getBottom() &= this.mHeaderHeight) {
ViewGroup.LayoutParams localLayoutParams = this.mHeaderContainer
.getLayoutParams();
float f = ((paramMotionEvent.getY(j) - this.mLastMotionY + this.mHeaderContainer
.getBottom()) / this.mHeaderHeight - this.mLastScale)
/ 2.0F + this.mLastS
if ((this.mLastScale &= 1.0D) && (f & this.mLastScale)) {
localLayoutParams.height = this.mHeaderH
this.mHeaderContainer
.setLayoutParams(localLayoutParams);
return super.onTouchEvent(paramMotionEvent);
this.mLastScale = Math.min(Math.max(f, 1.0F),
this.mMaxScale);
localLayoutParams.height = ((int) (this.mHeaderHeight * this.mLastScale));
if (localLayoutParams.height & this.mScreenHeight)
this.mHeaderContainer
.setLayoutParams(localLayoutParams);
this.mLastMotionY = paramMotionEvent.getY(j);
this.mLastMotionY = paramMotionEvent.getY(j);
4、在放开手指的时候,开启动画恢复到原来的位置,线程中循环调用改变imageview的高度,知道满足条件退出循环。
public void run() {
ViewGroup.LayoutParams localLayoutP
if ((!this.mIsFinished) && (this.mScale & 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) this.mStartTime)
/ (float) this.mD
f2 = this.mScale - (this.mScale - 1.0F)
* PullToZoomListView.sInterpolator.getInterpolation(f1);
localLayoutParams = PullToZoomListView.this.mHeaderContainer
.getLayoutParams();
if (f2 & 1.0F) {
Log.d(&mmm&, &f2&1.0&);
localLayoutParams.height = PullToZoomListView.this.mHeaderH
localLayoutParams.height = ((int) (f2 * PullToZoomListView.this.mHeaderHeight));
PullToZoomListView.this.mHeaderContainer
.setLayoutParams(localLayoutParams);
PullToZoomListView.this.post(this);
this.mIsFinished =
难点不在于如何改变mHeaderContainer的高度吧,难在如何让一个View按一定的时间曲线改变属性,这其实是属性动画该做的事,但是这里没有用属性动画,显然作者对View的动画很熟悉,我觉得这里作者用自己的方法实现了属性动画, ScalingRunnalable在startAnimation中调用了PullToZoomListView.this.post(this);不懂得可以搜索View.post(Runnable),post调用ScalingRunnalable的run方法,而ScalingRunnalable
run方法中再次调用了post,就这样不断的更新UI,直到达到一定的条件退出这个循环(这里这个条件是if((!this.mIsFinished) && (this.mScale & 1.0D))),这里的关键点是每次执行run的时候mHeaderContainer的高度究竟该变化多少,
f2 =this.mScale - (this.mScale
&&&&&&&&&&&&&&&&&&&&* PullToZoomListView.sInterpolator.getInterpolation(f1);
中PullToZoomListView.sInterpolator.getInterpolation(f1)给了我们答案
public float getInterpolation(float paramAnonymousFloat) {
float f = paramAnonymousFloat - 1.0F;
return 1.0F + f * (f * (f * (f * f)));
这个方法其实是一个指数函数,中学的时候学过y=1+f^4;也就是动画Intepolater速度变化是以这个指数增长。
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:153341次
积分:3278
积分:3278
排名:第9428名
原创:171篇
转载:17篇
评论:71条
文章:19篇
阅读:5943
(1)(6)(1)(9)(18)(3)(7)(4)(3)(18)(4)(6)(1)(2)(1)(2)(1)(2)(2)(1)(1)(3)(1)(5)(2)(7)(7)(11)(7)(6)(11)(3)(9)(7)(6)(12)

我要回帖

更多关于 pulllistview自动刷新 的文章

 

随机推荐