`
liuqun_567
  • 浏览: 36318 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

高仿新浪微博下拉刷新

阅读更多
自己写了个模仿新浪下拉刷新的效果。通过菜单选择 自动加载更多 或 手动加载更多。绝非修改国外那哥们写的。

改进版 下拉刷新 代码:

效果请访问 www.lianluoquan.com

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Scroller;
import android.widget.TextView;
import android.widget.Toast;

public class SimplePullDownView extends FrameLayout implements
GestureDetector.OnGestureListener, Animation.AnimationListener {

String tag = "SimplePullDownView";
private class CheckForLongPress implements Runnable {
public void run() {
//        Log.e(tag, "长按检查方法执行");
if(mListView.getOnItemLongClickListener() == null){
/*MotionEvent e = MotionEvent.obtain(downEvent.getDownTime(), downEvent.getEventTime() + ViewConfiguration.getLongPressTimeout() + 100, MotionEvent.ACTION_CANCEL, downEvent.getX(), downEvent.getY(), downEvent.getMetaState());
SimplePullDownView.super.dispatchTouchEvent(e);*/
}
else {
postDelayed(mPendingCheckForLongPress2, 100);
}
}
}
    private class CheckForLongPress2 implements Runnable {
        public void run() {
//        Log.e(tag, "长按检查方法执行2 ----> 延后 100 " );
mLongPressing = true;
MotionEvent e = MotionEvent.obtain(downEvent.getDownTime(), downEvent.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, downEvent.getX(), downEvent.getY(), downEvent.getMetaState());
    SimplePullDownView.super.dispatchTouchEvent(e);
        }
    }

class FlingRunnable implements Runnable {

private void startCommon() {
removeCallbacks(this);
}

public void run() {
boolean noFinish = mScroller.computeScrollOffset();
int curY = mScroller.getCurrY();
int deltaY = curY - mLastFlingY;
// Log.e("SimplePullDownView", "deltaY = " + deltaY + " , noFinish = " + noFinish);
// updateView();
if (noFinish/* && deltaY!=0*/) {
move(deltaY, true);
mLastFlingY = curY;
post(this);
} else {
removeCallbacks(this);
if(mState == SCROLL_TO_CLOSE){
mState = -1;
}
}
}

public void startUsingDistance(int distance, int duration) {
if (distance == 0)
distance--;
startCommon();
mLastFlingY = 0;
mScroller.startScroll(0, 0, 0, distance, duration);
post(this);
}

private int mLastFlingY;
private Scroller mScroller;

public FlingRunnable() {
mScroller = new Scroller(getContext());
}
}

public interface OnRefreshListioner {
public abstract void onRefresh();
public abstract void onLoadMore();
}

public SimplePullDownView(Context context) {
super(context);
mDetector = new GestureDetector(context, this);
mFlinger = new FlingRunnable();
init();
addRefreshBar();
}

public SimplePullDownView(Context context, AttributeSet att) {
super(context, att);
useempty = att.getAttributeBooleanValue(null, "useempty", true);
//Log.e(tag, "useempty = " + useempty);
mDetector = new GestureDetector(this);
mFlinger = new FlingRunnable();
init();
addRefreshBar();
}

private void addRefreshBar() {

mAnimationUp = AnimationUtils.loadAnimation(getContext(), R.anim.rotate_up);
mAnimationUp.setAnimationListener(this);
mAnimationDown = AnimationUtils.loadAnimation(getContext(),R.anim.rotate_down);
mAnimationDown.setAnimationListener(this);

View view = LayoutInflater.from(getContext()).inflate(R.layout.refresh_bar, null);
// view.setVisibility(View.INVISIBLE);
view.setBackgroundColor(0xfff4f4f4);
addView(view);
mFirstChild = (LinearLayout) view;
mUpdateContent = (FrameLayout) getChildAt(0).findViewById(R.id.iv_content);

mArrow = new ImageView(getContext());
mArrow.setBackgroundColor(0xfff4f4f4);
FrameLayout.LayoutParams layoutparams = new FrameLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
mArrow.setScaleType(ImageView.ScaleType.FIT_CENTER);
mArrow.setLayoutParams(layoutparams);
mArrow.setImageResource( R.drawable.arrow_down);

mUpdateContent.addView(mArrow);

FrameLayout.LayoutParams layoutparams1 = new FrameLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
layoutparams1.gravity = Gravity.CENTER;
// int defstyle = android.R.style.Widget_ProgressBar_Small_Inverse;
mProgressBar = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleSmallInverse);
mProgressBar.setIndeterminate(false);
mProgressBar.setBackgroundColor(0xfff4f4f4);
// mProgressBar.setIndeterminateDrawable(getResources().getDrawable(R.drawable.progress_small));
int i = getResources().getDimensionPixelSize(R.dimen.updatebar_padding);
mProgressBar.setPadding(i, i, i, i);
mProgressBar.setLayoutParams(layoutparams1);

mUpdateContent.addView(mProgressBar);

mTitle = (TextView) findViewById(R.id.ref_title);
}

@Override
protected void onFinishInflate() {
super.onFinishInflate();
mListView = (ListView) getChildAt(1);
footer_layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.empty_main, null);
foot = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ref2, null);
// footer_layout.addView(foot);
more = (TextView) foot.findViewById(R.id.ref);
mProgressBar2 = (ProgressBar) foot.findViewById(R.id.refbar);
// mProgressBar2.setVisibility(View.INVISIBLE);
if(useempty){
header = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.empty_main, null);
mListView.addHeaderView(header);
}
mListView.addFooterView(footer_layout);

foot.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
if(!isAutoLoadMore)
onLoadMore();
}
});
mListView.setOnScrollListener(new OnScrollListener() {

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// Log.i("SimplePullDownView", "scrollState = " + scrollState);
if(isEnd && scrollState == SCROLL_STATE_IDLE && hasMore && isAutoLoadMore){
onLoadMore();
}
}

@Override
public void onScroll(AbsListView view, int f, int v, int t) {
// Log.i("SimplePullDownView", "first = " + f + " , visable = " + v + " , total = " + t + " , hasMore = " + hasMore);
if(isAutoLoadMore){
if(f + v >= t - 1)
isEnd = true;
else
isEnd = false;
}
}
});
}

   
/**
* 设置没有数据时默认图片
* @param empty
*/
public void setEmptyHeaderView(View empty){
emptyHeaderView = empty;
}

public void addEmptyHeaderView(){
header.removeAllViews();
if(emptyHeaderView != null)
header.addView(emptyHeaderView);
}

public void removeEmptyHeaderView(){
if(emptyHeaderView != null)
header.removeView(emptyHeaderView);
}

private void init() {
MAX_LENGHT = getResources().getDimensionPixelSize(R.dimen.updatebar_height );//62.0dip
setDrawingCacheEnabled(false);
setBackgroundDrawable(null);
setClipChildren(false);
mDetector.setIsLongpressEnabled(false);
mPading = -MAX_LENGHT;
// mLastPading = -MAX_LENGHT;
mLastTop = -MAX_LENGHT;
pulldowntorefresh = getContext().getText(R.string.drop_dowm).toString();
releasetorefresh = getContext().getText(R.string.release_update).toString();
loading = getContext().getText(R.string.doing_update).toString();
update_time = getContext().getText(R.string.update_time).toString();
}

/** deltaY > 0 向上 */
private boolean move(float deltaY, boolean auto) {
// //Log.e("SimplePullDownView","move 方法执行 " );
if(deltaY > 0 && mFirstChild.getTop() == -MAX_LENGHT){
mPading = -MAX_LENGHT;
return false;
}

if(auto){
// Log.i("SimplePullDownView","move 方法执行  mPading = " + mPading);
if(mFirstChild.getTop()-deltaY < mDestPading){
deltaY = mFirstChild.getTop() - mDestPading;
}
mFirstChild.offsetTopAndBottom((int) -deltaY);
mListView.offsetTopAndBottom((int) -deltaY);
mPading = mFirstChild.getTop();
if(mDestPading == 0 && mFirstChild.getTop() == 0 && mState ==SCROLL_TO_REFRESH ){
//Log.e("SimplePullDownView","onRefresh 刷新方法执行 --->");
onRefresh();
} else if(mDestPading == -MAX_LENGHT){
}
invalidate();
updateView();
return true;
} else {
if(mState != STATE_REFRESH || (mState == STATE_REFRESH && deltaY>0)){
mFirstChild.offsetTopAndBottom((int) -deltaY);
mListView.offsetTopAndBottom((int) -deltaY);
mPading = mFirstChild.getTop();
} else if(mState == STATE_REFRESH && deltaY<0 && mFirstChild.getTop()<=0){
if(mFirstChild.getTop() - deltaY > 0){
deltaY = mFirstChild.getTop();
}
mFirstChild.offsetTopAndBottom((int) -deltaY);
mListView.offsetTopAndBottom((int) -deltaY);
mPading = mFirstChild.getTop();
}
}
if(deltaY > 0 && mFirstChild.getTop() <= -MAX_LENGHT){
mPading = -MAX_LENGHT;
deltaY = -MAX_LENGHT - mFirstChild.getTop();
mFirstChild.offsetTopAndBottom((int) deltaY);
mListView.offsetTopAndBottom((int) deltaY);
mPading = mFirstChild.getTop();
updateView();
invalidate();
return false;
}
updateView();
invalidate();
return true;
    }

private void updateView() {
String s = "";
s = mDate == null? "" : update_time + mDate ;
if(mState != STATE_REFRESH){
if(mFirstChild.getTop() < 0){
mArrow.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
mTitle.setText(pulldowntorefresh +  s);

if(mLastTop >= 0 && mState != SCROLL_TO_CLOSE){
mArrow.startAnimation(mAnimationUp);
//Log.i("SimplePullDownView", " mAnimationUp 上动画 " );
}

} else if(mFirstChild.getTop() > 0){
mTitle.setText(releasetorefresh +  s);
mProgressBar.setVisibility(View.INVISIBLE);
mArrow.setVisibility(View.VISIBLE);

if(mLastTop <= 0 ){
mArrow.startAnimation(mAnimationDown);
//Log.i("SimplePullDownView", " mAnimationDown 下动画 " );
}
}
}
mLastTop = mFirstChild.getTop();
    }

private boolean release()
    {
//Log.i("SimplePullDownView", "release 方法执行 = " + " , mFirstChild.getTop() = " + mFirstChild.getTop());
if(listviewDoScroll){
listviewDoScroll = false;
return true;
}
if(mFirstChild.getTop()>0){
scrollToUpdate();
} else {
scrollToClose();
// mDestPading = -MAX_LENGHT;
}
invalidate();
return false;
    }

private void scrollToClose() {
mDestPading = -MAX_LENGHT;
mFlinger.startUsingDistance(MAX_LENGHT, CLOSEDELAY);
}

private void scrollToUpdate() {
mState = SCROLL_TO_REFRESH;
//Log.e("SimplePullDownView", "scrollToUpdate 方法执行");
mDestPading = 0;
mFlinger.startUsingDistance(mFirstChild.getTop(), REFRESHDELAY);
}

private void onRefresh(){

mState = STATE_REFRESH;
String s = "";
if(mDate == null)
s = "";
else
s = update_time + mDate;
mTitle.setText(loading +  s);
mProgressBar.setVisibility(View.VISIBLE);
mArrow.setVisibility(View.INVISIBLE);
if(mRefreshListioner != null){
mRefreshListioner.onRefresh();
}
}

public void onRefreshComplete(){
onRefreshComplete(null);
}

public void onRefreshComplete(String date){
//Log.e("SimplePullDownView", "onRefreshComplete 方法执行 ");
mDate = date;
mState = SCROLL_TO_CLOSE;
/* mPading = -MAX_LENGHT;
mLastPading = -MAX_LENGHT;*/
mArrow.setImageResource(R.drawable.arrow_down);
mProgressBar2.setVisibility(View.INVISIBLE);
updateCommon();
scrollToClose();
}

private void updateCommon(){
if(mListView.getCount() == (mListView.getHeaderViewsCount() + mListView.getFooterViewsCount())){
Log.e("out", "数据为空");
if(useempty)
addEmptyHeaderView();
footer_layout.removeAllViews();
mListView.setFooterDividersEnabled(false);
} else {
removeEmptyHeaderView();
if(hasMore){
mListView.setFooterDividersEnabled(true);
footer_layout.removeAllViews();
footer_layout.addView(foot);
}else {
mListView.setFooterDividersEnabled(false);
footer_layout.removeAllViews();
}
}
}

public void onFirstLoad(){
if(footer_layout.getChildCount() == 0){
footer_layout.addView(foot);
}
isFirstLoading = true;
foot.setEnabled(false);
//Log.e("SimplePullDownView", "onFirstLoad 方法执行 ");
mState = STATE_REFRESH;
mProgressBar2.setVisibility(View.VISIBLE);
more.setText(R.string.loading2);
}

public void onLoadMore(){
//Log.e("SimplePullDownView", "onLoadMore 方法执行 ");
foot.setEnabled(false);
mState = STATE_REFRESH;
mProgressBar2.setVisibility(View.VISIBLE);
more.setText(R.string.loading2);
if(mRefreshListioner != null){
mRefreshListioner.onLoadMore();
}
}

public void onLoadMoreComplete(String date){
//Log.e("SimplePullDownView", "onLoadMoreComplete 方法执行 ");
mDate = date;
mState = -1;
mProgressBar2.setVisibility(View.INVISIBLE);
more.setText(R.string.more);
updateCommon();
if(isFirstLoading)
isFirstLoading = false;
foot.setEnabled(true);
}

public void onLoadMoreComplete( ){
onLoadMoreComplete(null);
}


public boolean dispatchTouchEvent(MotionEvent e){
//Log.e("SimplePullDownView", "dispatchTouchEvent ----------> ");
if(isFirstLoading){
return false;
}
int action;
float y = e.getY();
action = e.getAction();
if(mLongPressing && action != MotionEvent.ACTION_DOWN){
return false;
}
if(e.getAction() == MotionEvent.ACTION_DOWN){
mLongPressing = true;
}
boolean handled = true;
        handled = mDetector.onTouchEvent(e);
//         if(!handled)
//         Log.i("SimplePullDownView", " mDetector.onTouchEvent handled = " + handled + " , mPading = " + mPading);
        switch (action) {
        case MotionEvent.ACTION_UP:
        /*mListView.getHitRect(r);
        boolean f = r.contains((int)e.getX(), (int)e.getY());*/
        boolean f1 = mListView.getTop() <= e.getY() && e.getY() <= mListView.getBottom();
//         Log.e("SimplePullDownView", " ACTION_UP -------> handled = " + handled + " , f1 = " + f1 + " , top == -MAX = " +(mFirstChild.getTop() == -MAX_LENGHT) );
        if(!handled && mFirstChild.getTop() == -MAX_LENGHT && f1 || mState == STATE_REFRESH){
        super.dispatchTouchEvent(e);
        }
        else{
//         Log.e("SimplePullDownView", "执行释放方法  listviewDoScroll = " + listviewDoScroll);
        handled = release();
        }
        break;
        case MotionEvent.ACTION_CANCEL:
//         Log.e(tag, " event: ACTION_CANCEL" );
        handled = release();
        super.dispatchTouchEvent(e);
        break;
        case MotionEvent.ACTION_DOWN:
        downEvent = e;
        mLongPressing = false;
//         Log.e(tag, " 长按的时间间隔:" + ViewConfiguration.getLongPressTimeout());
        postDelayed(mPendingCheckForLongPress, ViewConfiguration.getLongPressTimeout()+ 100);
        mPendingRemoved = false;
        downPostion = mListView.pointToPosition((int)e.getX(), (int)e.getY()) - mListView.getHeaderViewsCount();
       
        //Log.e("SimplePullDownView", "downPostion = " + downPostion);
        super.dispatchTouchEvent(e);
break;
case MotionEvent.ACTION_MOVE:
float deltaY = lastY - y;
lastY = y;
if(!mPendingRemoved){
removeCallbacks(mPendingCheckForLongPress);
mPendingRemoved = true;
}
//Log.e("SimplePullDownView","handled = " + handled + " , top = " + mFirstChild.getTop());

if(!handled && mFirstChild.getTop() == -MAX_LENGHT){
try{
return super.dispatchTouchEvent(e);
} catch (Exception e2) {
e2.printStackTrace();
return true;
}
}
else if(handled && mListView.getTop() > 0 && deltaY < 0){//deltaY小于0,向下
e.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(e);
}
break;

default:
break;
}

return true;
    }

public void onAnimationEnd(Animation animation) {
int top = mFirstChild.getTop();
if (top < 0)
mArrow.setImageResource(R.drawable.arrow_down);
else if (top > 0)
mArrow.setImageResource(R.drawable.arrow_up);
else {
if(top < mLastTop){
mArrow.setImageResource(R.drawable.arrow_down);
} else {
mArrow.setImageResource(R.drawable.arrow_up);
}
}
}

public void onAnimationRepeat(Animation animation) {
}

public void onAnimationStart(Animation animation) {
}

public boolean onDown(MotionEvent e) {
return false;
}

public boolean onFling(MotionEvent motionevent, MotionEvent e,
float f, float f1) {
return false;
}

protected void onLayout(boolean flag, int i, int j, int k, int l) {
// Log.i("SimplePullDownView", "onLayout 方法执行 ------> mPading =  " + mPading + " , listTop = " + (mPading + MAX_LENGHT));
int top = mPading;
int w = getMeasuredWidth();
mFirstChild.layout(0, top, w, top + MAX_LENGHT);

int h = getMeasuredHeight() + mPading + MAX_LENGHT;
mListView.layout(0, top + MAX_LENGHT , w, h);
}

public void onLongPress(MotionEvent e) {
}
/** deltaY > 0 向上*/
public boolean onScroll(MotionEvent curdown, MotionEvent cur, float deltaX, float deltaY) {
// mListView.getHitRect(r);
// Log.i("SimplePullDownView", "父亲高度 : = " + getHeight() + " , width = " + r.width() + " , height = " + r.height() + " , top = " + r.top + " , bottom = " + r.bottom);
deltaY = (float) ((double) deltaY * SCALE);
boolean handled = false;
boolean flag = false;
if (mListView.getCount() == 0) {
flag = true;
} else {
View c = mListView.getChildAt(0);
if (mListView.getFirstVisiblePosition() == 0 && c!=null && c.getTop() == 0){
flag = true;
}
// Log.i("SimplePullDownView","onScroll 方法执行  mPading = " + mPading + ", mTop = " + adapterview.getTop() + " flag = " + flag + " , deltaY = " + deltaY);
}
if (deltaY < 0F && flag || getChildAt(0).getTop() > -MAX_LENGHT){ //deltaY < 0 向下
handled = move(deltaY, false);
// Log.i("SimplePullDownView", "满足条件 执行 move 方法, handled = " + handled);
}
else
handled = false;
// Log.i("SimplePullDownView", " onScroll  handled = " + handled);
return handled;
}

public void onShowPress(MotionEvent motionevent) {
}

public boolean onSingleTapUp(MotionEvent motionevent) {
return false;
}

public void setRefreshListioner(OnRefreshListioner RefreshListioner) {
mRefreshListioner = RefreshListioner;
}


public boolean isAutoLoadMore() {
return isAutoLoadMore;
}

public void setAutoLoadMore(boolean isAutoLoadMore) {
this.isAutoLoadMore = isAutoLoadMore;
if(!isAutoLoadMore){
foot.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
onLoadMore();
}
});
mListView.setOnScrollListener(null);
} else {
mListView.setOnScrollListener(new OnScrollListener() {

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// Log.i("SimplePullDownView", "scrollState = " + scrollState);
if(isEnd && scrollState == SCROLL_STATE_IDLE && hasMore){
onLoadMore();
}
}

@Override
public void onScroll(AbsListView view, int f, int v, int t) {
// Log.i("SimplePullDownView", "first = " + f + " , visable = " + v + " , total = " + t + " , hasMore = " + hasMore);
if(f + v >= t - 1)
isEnd = true;
else
isEnd = false;
}
});
foot.setOnClickListener(null);
}
}

public void setHasMore(boolean hasMore) {
this.hasMore = hasMore;
}

public void removeFoot(){
footer_layout.removeAllViews();
}

public void addFoot(){
footer_layout.removeAllViews();
footer_layout.addView(foot);
}

public static int MAX_LENGHT = 0;
public static final int STATE_REFRESH = 1;
public static final int SCROLL_TO_CLOSE = 2;
public static final int SCROLL_TO_REFRESH = 3;
public static final double SCALE = 0.9d;
private static final int CLOSEDELAY = 300;
private static final int REFRESHDELAY = 300;
private Animation mAnimationDown;
private Animation mAnimationUp;
private ImageView mArrow;
private String mDate;
private View emptyHeaderView;
private ProgressBar mProgressBar;
private TextView more;
private ProgressBar mProgressBar2;
private int mState;
private TextView mTitle;
ListView mListView;
LinearLayout foot;
LinearLayout footer_layout;
LinearLayout header;
private GestureDetector mDetector;
private FlingRunnable mFlinger;
private int mPading;
private int mDestPading;
// private int mLastPading;
private int mLastTop;
private LinearLayout mFirstChild;
private FrameLayout mUpdateContent;
private OnRefreshListioner mRefreshListioner;
private boolean isAutoLoadMore = false;
private boolean hasMore = true;
private boolean isEnd = true;
private boolean listviewDoScroll = false;
private boolean isFirstLoading = false;
// private boolean mIsAutoScroller;
private boolean mLongPressing;//如果设置为true说明刚好到了执行长按的时间
private boolean mPendingRemoved = false;//
private String pulldowntorefresh;
private String releasetorefresh;
private String loading;
private String update_time;
Rect r = new Rect();
private int downPostion;
private MotionEvent downEvent;
private CheckForLongPress mPendingCheckForLongPress = new CheckForLongPress();
private CheckForLongPress2 mPendingCheckForLongPress2 = new CheckForLongPress2();
private float lastY;
private boolean useempty = true;
}
  • 大小: 77.9 KB
  • 大小: 77 KB
4
0
分享到:
评论
13 楼 godcok 2012-02-10  
godcok 写道
godcok 写道
朋友您的下拉刷新我看过了,挺好,也在您的基础上实现了同样的功能,不过不知道怎么搞的列表会重复刷新.特别列表第一次载入和下拉的时候重复刷新特别明显.请问您遇到同样的问题了吗?

如果方便的话请e_mail联系godcok@163.com,谢谢

问题已经解决了,不用联系了谢谢。
12 楼 penghanying 2012-02-06  
大哥 牛逼 给个源码 670166270@qq.com
11 楼 godcok 2012-02-02  
godcok 写道
朋友您的下拉刷新我看过了,挺好,也在您的基础上实现了同样的功能,不过不知道怎么搞的列表会重复刷新.特别列表第一次载入和下拉的时候重复刷新特别明显.请问您遇到同样的问题了吗?

如果方便的话请e_mail联系godcok@163.com,谢谢
10 楼 godcok 2012-02-02  
朋友您的下拉刷新我看过了,挺好,也在您的基础上实现了同样的功能,不过不知道怎么搞的列表会重复刷新.特别列表第一次载入和下拉的时候重复刷新特别明显.请问您遇到同样的问题了吗?
9 楼 119568242 2012-01-10  
liuqun_567 写道
哥们儿,那个源码是我反编译新浪微博的下拉刷新然后受到一些启发自己写出了的,但是那些布局文件和资源文件都是直接拿过了的,所以我不敢把源码公开,我怕他们找我麻烦。既然你都这么说了,这两天我整理整理,给你份源码,不过我给你提个建议,这个下拉刷新就是自定义View,但是你要想看懂,你必须熟悉VieW的事件委派和处理机制,否则给你源代码你也看不懂。

=-=表示看错了一个东西 不过也希望认识下您
8 楼 119568242 2012-01-10  
谢谢兄弟了 最早找到 是在一个android网[忘记是哪个了 不怎么知名的] 然后 发帖人说是从外国找的。。所以我就拿来改了改用了
不好意思哈
需要我删掉我那个blog么?
求+好友Q:119568242
liuyuanbolyb@126.com
7 楼 liuqun_567 2012-01-10  
哥们儿,那个源码是我反编译新浪微博的下拉刷新然后受到一些启发自己写出了的,但是那些布局文件和资源文件都是直接拿过了的,所以我不敢把源码公开,我怕他们找我麻烦。既然你都这么说了,这两天我整理整理,给你份源码,不过我给你提个建议,这个下拉刷新就是自定义View,但是你要想看懂,你必须熟悉VieW的事件委派和处理机制,否则给你源代码你也看不懂。
6 楼 jipengweb 2011-12-30  
大哥,我把你上传的apk反编译了,但是那些代码中有些地方理解起来实在很费劲,不得不麻烦你了,能不能把源码共享下
5 楼 lkf871224 2011-12-02  
发个源码呗liuclff@163.com,省的大家反编译了!
4 楼 liuqun_567 2011-12-02  
对啊,可以反编译啊,我也是反编译新浪微博的下拉刷新然后自己写的
3 楼 119568242 2011-12-02  
= -=反编译看看不就行了。。。看来楼上2位都是拿来主义- -
2 楼 zghlezh 2011-11-24  
给个apk 有吊用
1 楼 u370249526 2011-10-17  
大哥。。贴源码撒。

相关推荐

    高仿新浪微博Android下拉刷新自动加载更多

    在Android应用开发中,"高仿新浪微博Android下拉刷新自动加载更多"是一个常见的功能需求,它结合了下拉刷新(Pull-to-Refresh)和上拉加载更多(Infinite Scrolling)两种交互模式,提升了用户体验,使得用户在滚动...

    jquery高仿新浪微博图片显示插件

    【jQuery高仿新浪微博图片显示插件】是一种基于JavaScript库jQuery实现的、旨在模仿新浪微博图片展示效果的组件。这款插件的开发灵感来源于新浪微博的图片浏览功能,它旨在为用户提供一个高度自定义且易于集成的解决...

    高仿新浪微博个人主页html网站模板

    高仿新浪微博个人主页html网站模板

    高仿新浪微博的引导界面

    【标题】:“高仿新浪微博的引导界面” 在Android应用开发中,为了提升用户体验,很多App在初次启动时会展示一个引导界面,引导用户了解应用的主要功能。本项目以“高仿新浪微博的引导界面”为主题,旨在教授如何在...

    Android 毕业设计高仿新浪微博客户端(内附源码)

    Android 毕业设计高仿新浪微博客户端,适用于大家课程设计和毕业设计。 一款独立开发的第三方新浪微博客户端,在还原了官方微博的UI的同时,加入更多不同于官方微博的新特性,给用户带来更加流畅,没有广告的体验,...

    高仿新浪微博弹框菜单

    在Android开发中,"高仿新浪微博弹框菜单"是一个常见的用户界面组件,它提供了一种类似于新浪微博应用中的交互式弹出菜单。这种菜单通常在用户点击某个按钮或执行特定操作时从屏幕边缘滑出,展示一系列可选的操作或...

    Android 毕业设计高仿新浪微博客户端(内附源码,下载即用)

    Android 毕业设计高仿新浪微博客户端,适用于大家课程设计和毕业设计。 一款独立开发的第三方新浪微博客户端,在还原了官方微博的UI的同时,加入更多不同于官方微博的新特性,给用户带来更加流畅,没有广告的体验,...

    记事狗高仿新浪微博 v3.0-源码.zip

    《记事狗高仿新浪微博 v3.0 源码解析与探讨》 在IT行业中,源码是软件开发的核心,它揭示了程序运行的内在逻辑和实现方式。本篇文章将围绕“记事狗高仿新浪微博 v3.0”的源码进行深度分析,帮助读者理解其设计思想...

    高仿新浪微博tab

    在Android应用开发中,"高仿新浪微博tab"通常是指创建一个与新浪微博类似的底部导航栏,它包含多个Tab,每个Tab对应不同的功能模块,如“首页”、“发现”、“消息”和“我”的页面。这种设计模式是用户界面设计中...

    高仿新浪微博访客视图,首页,发布界面等使用技术

    html简单网页代码 高仿新浪微博访客视图,首页,发布界面等使用技术:MVVM设计模式,使用纯代码和Xib混合开发,使用SnapKit做UI布局,AFN网络数据请求,MJExtension进行字典转模型数据,使用SDWebImage进行图片加载...

    J2EE高仿新浪微博完整项目(包括JSP、SQL、后台代码)

    【J2EE高仿新浪微博完整项目】是一个基于Java企业版(Java 2 Platform, Enterprise Edition,简称J2EE)技术的开发案例,旨在提供一个类似于新浪微博的社交网络平台的实现。这个项目涵盖了JSP(JavaServer Pages)、...

    sina-popmenu, 高仿新浪微博弹框菜单.zip

    《高仿新浪微博弹框菜单——sina-popmenu开源项目解析》 在当今互联网产品中,交互设计的重要性不言而喻,而弹框菜单作为一种常见的交互元素,被广泛应用于各种应用场景,如社交网络、新闻资讯、电子商务等。在众多...

Global site tag (gtag.js) - Google Analytics