- 浏览: 5779457 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (890)
- WindowsPhone (0)
- android (88)
- android快速迭代 (17)
- android基础 (34)
- android进阶 (172)
- android高级 (0)
- android拾遗 (85)
- android动画&效果 (68)
- Material Design (13)
- LUA (5)
- j2me (32)
- jQuery (39)
- spring (26)
- hibernate (20)
- struts (26)
- tomcat (9)
- javascript+css+html (62)
- jsp+servlet+javabean (14)
- java (37)
- velocity+FCKeditor (13)
- linux+批处理 (9)
- mysql (19)
- MyEclipse (9)
- ajax (7)
- wap (8)
- j2ee+apache (24)
- 其他 (13)
- phonegap (35)
最新评论
-
Memories_NC:
本地lua脚本终于执行成功了,虽然不是通过redis
java中调用lua脚本语言1 -
ZHOU452840622:
大神://处理返回的接收状态 这个好像没有监听到 遇 ...
android 发送短信的两种方式 -
PXY:
拦截部分地址,怎么写的for(int i=0;i<lis ...
判断是否登录的拦截器SessionFilter -
maotou1988:
Android控件之带清空按钮(功能)的AutoComplet ...
自定义AutoCompleteTextView -
yangmaolinpl:
希望有表例子更好。。。,不过也看明白了。
浅谈onInterceptTouchEvent、onTouchEvent与onTouch
使用的是第三方开发包CWAC-AdapterWrapper.jar
row.xml
main.xml
http://blog.sina.com.cn/s/blog_643e83860100q4vj.html
精确监听AbsListView滚动至底部
http://blog.csdn.net/hellogv/article/details/6615487
Android ListView pull up to refresh
http://www.iteye.com/topic/1116292
https://github.com/johannilsson/android-pulltorefresh
完整工程:
package com.ql.app; /*** Copyright (c) 2008-2009 CommonsWare, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import java.util.ArrayList; import android.app.ListActivity; import android.os.Bundle; import android.os.SystemClock; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.widget.ArrayAdapter; import android.widget.SimpleAdapter; /** * 这个库不好之处,就是底部Loading的View无法定制 * http://blog.sina.com.cn/s/blog_643e83860100q4vj.html * @author admin * */ public class EndlessAdapterDemo extends ListActivity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); ArrayList<Integer> items=new ArrayList<Integer>(); for (int i=0;i<15;i++) { items.add(i); } setListAdapter(new DemoAdapter(items)); } class DemoAdapter extends EndlessAdapter { private RotateAnimation rotate=null; DemoAdapter(ArrayList<Integer> list) { super(new ArrayAdapter<Integer>(EndlessAdapterDemo.this, R.layout.row,android.R.id.text1,list)); rotate=new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f); rotate.setDuration(600); rotate.setRepeatMode(Animation.RESTART); rotate.setRepeatCount(Animation.INFINITE); } @Override protected View getPendingView(ViewGroup parent) { View row=getLayoutInflater().inflate(R.layout.row, null); View child=row.findViewById(android.R.id.text1); child.setVisibility(View.GONE); child=row.findViewById(R.id.throbber); child.setVisibility(View.VISIBLE); child.startAnimation(rotate); return(row); } @Override protected boolean cacheInBackground() { SystemClock.sleep(5000); // pretend to do work return(getWrappedAdapter().getCount()<75); } @Override protected void appendCachedData() { if (getWrappedAdapter().getCount()<75) { @SuppressWarnings("unchecked") ArrayAdapter<Integer> a=(ArrayAdapter<Integer>)getWrappedAdapter(); for (int i=0;i<15;i++) { a.add(a.getCount()); } } } } }
package com.ql.app; /*** Copyright (c) 2008-2009 CommonsWare, LLC Portions (c) 2009 Google, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import android.content.Context; import android.os.AsyncTask; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.util.Log; import android.widget.ListAdapter; import java.util.concurrent.atomic.AtomicBoolean; import com.commonsware.cwac.adapter.AdapterWrapper; /** * Adapter that assists another adapter in appearing endless. * For example, this could be used for an adapter being * filled by a set of Web service calls, where each call returns * a "page" of data. * * Subclasses need to be able to return, via getPendingView() * a row that can serve as both a placeholder while more data * is being appended. * * The actual logic for loading new data should be done in * appendInBackground(). This method, as the name suggests, * is run in a background thread. It should return true if * there might be more data, false otherwise. * * If your situation is such that you will not know if there * is more data until you do some work (e.g., make another * Web service call), it is up to you to do something useful * with that row returned by getPendingView() to let the user * know you are out of data, plus return false from that final * call to appendInBackground(). */ abstract public class EndlessAdapter extends AdapterWrapper { abstract protected boolean cacheInBackground(); abstract protected void appendCachedData(); private View pendingView=null; private AtomicBoolean keepOnAppending=new AtomicBoolean(true); private Context context; private int pendingResource=-1; /** * Constructor wrapping a supplied ListAdapter */ public EndlessAdapter(ListAdapter wrapped) { super(wrapped); } /** * Constructor wrapping a supplied ListAdapter and providing a id for a pending view. * @param context * @param wrapped * @param pendingResource */ public EndlessAdapter(Context context, ListAdapter wrapped, int pendingResource) { super(wrapped); this.context=context; this.pendingResource=pendingResource; } /** * How many items are in the data set represented by this * Adapter. */ @Override public int getCount() { if (keepOnAppending.get()) { return(super.getCount()+1); // one more for "pending" } return(super.getCount()); } /** * Masks ViewType so the AdapterView replaces the "Pending" row when new * data is loaded. */ public int getItemViewType(int position) { if (position==getWrappedAdapter().getCount()) { return(IGNORE_ITEM_VIEW_TYPE); } return(super.getItemViewType(position)); } /** * Masks ViewType so the AdapterView replaces the "Pending" row when new * data is loaded. * * @see #getItemViewType(int) */ public int getViewTypeCount() { return(super.getViewTypeCount()+1); } /** * Get a View that displays the data at the specified * position in the data set. In this case, if we are at * the end of the list and we are still in append mode, * we ask for a pending view and return it, plus kick * off the background task to append more data to the * wrapped adapter. * @param position Position of the item whose data we want * @param convertView View to recycle, if not null * @param parent ViewGroup containing the returned View */ @Override public View getView(int position, View convertView, ViewGroup parent) { if (position==super.getCount() && keepOnAppending.get()) { if (pendingView==null) { pendingView=getPendingView(parent); new AppendTask().execute(); } return(pendingView); } return(super.getView(position, convertView, parent)); } /** * Called if cacheInBackground() raises a runtime exception, * to allow the UI to deal with the exception on the * main application thread. * @param pendingView View representing the pending row * @param e Exception that was raised by cacheInBackground() * @return true if should allow retrying appending new data, false otherwise */ protected boolean onException(View pendingView, Exception e) { Log.e("EndlessAdapter", "Exception in cacheInBackground()", e); return(false); } /** * A background task that will be run when there is a need * to append more data. Mostly, this code delegates to the * subclass, to append the data in the background thread and * rebind the pending view once that is done. */ class AppendTask extends AsyncTask<Void, Void, Exception> { @Override protected Exception doInBackground(Void... params) { Exception result=null; try { keepOnAppending.set(cacheInBackground()); } catch (Exception e) { result=e; } return(result); } @Override protected void onPostExecute(Exception e) { if (e==null) { appendCachedData(); } else { keepOnAppending.set(onException(pendingView, e)); } pendingView=null; notifyDataSetChanged(); } } /** * Inflates pending view using the pendingResource ID passed into the constructor * @param parent * @return inflated pending view, or null if the context passed into the pending view constructor was null. */ protected View getPendingView(ViewGroup parent) { if(context != null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return inflater.inflate(pendingResource, parent, false); } throw new RuntimeException("You must either override getPendingView() or supply a pending View resource via the constructor"); } }
row.xml
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:paddingLeft="6dip" android:minHeight="?android:attr/listPreferredItemHeight" /> <ImageView android:id="@+id/throbber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android:ic_popup_sync" android:layout_gravity="center_horizontal" android:visibility="gone" /> </FrameLayout>
main.xml
<?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:drawSelectorOnTop="false" />
http://blog.sina.com.cn/s/blog_643e83860100q4vj.html
精确监听AbsListView滚动至底部
http://blog.csdn.net/hellogv/article/details/6615487
Android ListView pull up to refresh
http://www.iteye.com/topic/1116292
https://github.com/johannilsson/android-pulltorefresh
完整工程:
- EndlessAdapterDemo.rar (57.5 KB)
- 下载次数: 80
- CWAC-AdapterWrapper.jar (4.7 KB)
- 下载次数: 64
- LoadingListView.rar (61.2 KB)
- 描述: 另一个延时加载的ListView(PageableListview)
- 下载次数: 111
- pulltorefreshexample.rar (92.2 KB)
- 描述: 下拉加载PullToRefreshListView
- 下载次数: 28
- TestPullListView.zip (195.4 KB)
- 描述: 老外的在上面的loading
- 下载次数: 34
发表评论
文章已被作者锁定,不允许评论。
-
NestedScrollView滚动到顶部固定子View悬停挂靠粘在顶端
2018-10-31 20:45 6812网上有一个StickyScrollView,称之为粘性Scro ... -
自定义Behavior实现AppBarLayout越界弹性效果
2017-03-31 09:33 10238一、继承AppBarLayout.Beha ... -
Android - 一种相似图片搜索算法的实现
2017-03-31 09:33 2570算法 缩小尺寸。 将图片缩小到8x8的尺寸,总共64个 ... -
使用SpringAnimation实现带下拉弹簧动画的 ScrollView
2017-03-30 11:30 2798在刚推出的 Support Library 25.3.0 里面 ... -
Android为应用添加角标(Badge)
2017-03-30 11:21 61081.需求简介 角标是什么意思呢? 看下图即可明了: 可 ... -
Android端与笔记本利用局域网进行FTP通信
2017-03-23 10:17 930先看图 打开前: 打开后: Activity类 ... -
PorterDuffColorFilter 在项目中的基本使用
2017-03-03 10:58 1301有时候标题栏会浮在内容之上,而内容会有颜色的变化,这时候就要求 ... -
ColorAnimationView 实现了滑动Viewpager 时背景色动态变化的过渡效果
2017-02-24 09:41 2173用法在注释中: import android.anima ... -
迷你轻量级全方向完美滑动处理侧滑控件SlideLayout
2017-01-16 16:53 2553纯手工超级迷你轻量级全方向完美滑动处理侧滑控件(比官方 sup ... -
Effect
2017-01-05 09:57 0https://github.com/JetradarMobi ... -
动态主题库Colorful,容易地改变App的配色方案
2016-12-27 14:49 2524Colorful是一个动态主题库,允许您很容易地改变App的配 ... -
对视图的对角线切割DiagonalView
2016-12-27 14:23 1075提供对视图的对角线切割,具有很好的用户定制 基本用法 ... -
仿淘宝京东拖拽商品详情页上下滚动黏滞效果
2016-12-26 16:53 3424比较常用的效果,有现成的,如此甚好!:) import ... -
让任意view具有滑动效果的SlideUp
2016-12-26 09:26 1664基本的类,只有一个: import android.a ... -
AdvancedWebView
2016-12-21 09:44 16https://github.com/delight-im/A ... -
可设置圆角背景边框的按钮, 通过调节色彩明度自动计算按下(pressed)状态颜色
2016-11-02 22:13 1864可设置圆角背景边框的的按钮, 通过调节色彩明度自动计算按下(p ... -
网络请求库相关
2016-10-09 09:35 62https://github.com/amitshekhari ... -
ASimpleCache一个简单的缓存框架
2015-10-26 22:53 2125ASimpleCache 是一个为android制定的 轻量级 ... -
使用ViewDragHelper实现的DragLayout开门效果
2015-10-23 10:55 3341先看一下图,有个直观的了解,向下拖动handle就“开门了”: ... -
保证图片长宽比的同时拉伸图片ImageView
2015-10-16 15:40 3681按比例放大图片,不拉伸失真 import android. ...
相关推荐
Lazyload是通过延迟加载来实现按需加载,达到节省资源,加快浏览速度的目的。 网上也有不少类似的效果,这个Lazyload主要特点是: 支持使用window(窗口)或元素作为容器对象; 对静态(位置大小不变)元素做了大量...
博客与文章作为例子,查询一个博客的时候并不是需要将其下面的文章都加载进来。把需要延迟加载的属性使用Lazy泛型,实例时候传入一个Fun委托。
图片延迟加载,可以增加用户体验,jQuery图片延迟加载插件jQuery.lazyload,使用延迟加载在可提高网页下载速度。在某些情况下,它也能帮助减轻服务器负载。
NULL 博文链接:https://xuwoool.iteye.com/blog/1306207
JQuery Lazyload加载图片实例
LazyLoad 图片延迟加载效果示例 LazyLoad 图片延迟加载效果示例,这是由cloudgamer编写的一个封装插件,用它可以完成不少的效果,现在这个是图片延迟效果,也就是说,我们需要显示的图片会先加载,暂时用不上的也就...
实现网页内容、图片延迟加载,没有浏览到的不显示,只有浏览器看到的才显示。
Lazyload图片延迟加载效果,很值得去学习的案例!
Hibernate延时加载与lazy机制.docHibernate延时加载与lazy机制.doc
你必须修改 HTML 代码. 在 src 属性中设置展位符图片, demo 页面使用 1x1 像素灰色 GIF 图片.... 这里可以定义特定的 class 以获得需要延迟加载的图片对象. 通过这种方法你可以简单地控制插件绑定.
LazyLoad,延时,懒加载,加载,图片,效果,特效,.rar,实用,网页,速度
Lazyload图片延迟加载效果
ListView 延迟加载 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new LongOperation(this,new Excution(){ @Override public void longExcute(){ ...
图片延迟加载实例。在chrome network中查看效果。简单易用 无冗余代码