当前位置: 首页>>代码示例>>Java>>正文


Java AbsListView类代码示例

本文整理汇总了Java中android.widget.AbsListView的典型用法代码示例。如果您正苦于以下问题:Java AbsListView类的具体用法?Java AbsListView怎么用?Java AbsListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbsListView类属于android.widget包,在下文中一共展示了AbsListView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canChildScrollUp

import android.widget.AbsListView; //导入依赖的package包/类
/**
 * Whether child view can scroll up
 * @return
 */
public boolean canChildScrollUp() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      return absListView.getChildCount() > 0
             && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                                                                  .getTop() < absListView.getPaddingTop());
    } else {
      return ViewCompat.canScrollVertically(mTargetView, -1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, -1);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXSwipeLayout.java

示例2: onScrollStateChanged

import android.widget.AbsListView; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    Log.d("onScrollStateChanged", "totalItemCount = " + totalItemCount +
            " lastVisibleItem = " + lastVisibleItem + " scrollState = " + scrollState);
    if (totalItemCount + getHeaderViewsCount() + getFooterViewsCount() == lastVisibleItem && scrollState == SCROLL_STATE_IDLE) {

        if (!isLoading) {

            isLoading = true;
            footer.findViewById(R.id.load_layout).setVisibility(View.VISIBLE);
            // 加载更多

            if (iLoadListener != null && !isLoadFinish) {

                iLoadListener.onLoad();
            } else {
                //所有内容加载完毕
                loadComplete(true);
            }

        }
    }
}
 
开发者ID:zhonglikui,项目名称:cardinalsSample,代码行数:24,代码来源:LoadListView.java

示例3: setItemVisible

import android.widget.AbsListView; //导入依赖的package包/类
/**
 * 隐藏或展示Item
 *
 * @param visible
 */
public void setItemVisible(boolean visible) {
    if (null != itemView) {
        if (visible) {
            if (null != itemView.getLayoutParams()) {
                itemView.getLayoutParams().width = AbsListView.LayoutParams.MATCH_PARENT;
                itemView.getLayoutParams().height = AbsListView.LayoutParams.WRAP_CONTENT;
            } else {
                itemView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT));
            }
            itemView.setVisibility(View.VISIBLE);
        } else {
            if (null != itemView.getLayoutParams()) {
                itemView.getLayoutParams().width = -1;
                itemView.getLayoutParams().height = 1;
            } else {
                itemView.setLayoutParams(new AbsListView.LayoutParams(-1, 1));
            }
            itemView.setVisibility(View.GONE);
        }
    }
}
 
开发者ID:GuoZhaoHui628,项目名称:SliderStatusBar,代码行数:27,代码来源:ViewHolder.java

示例4: canChildScrollDown

import android.widget.AbsListView; //导入依赖的package包/类
public boolean canChildScrollDown() {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);
            if (lastChild != null) {
                return (absListView.getLastVisiblePosition() == (absListView.getCount() - 1))
                        && lastChild.getBottom() > absListView.getPaddingBottom();
            } else {
                return false;
            }
        } else {
            return mTarget.getHeight() - mTarget.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:19,代码来源:PullRefreshLayout.java

示例5: canChildScrollUp

import android.widget.AbsListView; //导入依赖的package包/类
public static boolean canChildScrollUp(View view) {
    if (Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0
                    || absListView.getChildAt(0).getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(view, -1)
                    || view.getScrollY() > 0;
        }
    } else {
        if (Build.VERSION.SDK_INT < 26)
            return ViewCompat.canScrollVertically(view, -1);
        else
            return view.canScrollVertically(-1);
    }
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:19,代码来源:ScrollCompat.java

示例6: highlightItems

import android.widget.AbsListView; //导入依赖的package包/类
private void highlightItems(List<String> items) {
    if (items == null)
        return;
    if (items.size() > 1) {
        // Required for us to select all the new items. Gets reset to normal when one is selected.
        mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
    }
    int minIndex = Integer.MAX_VALUE;
    for (String path: items) {
        BookOrShelf item = _bookCollection.getBookByPath(path);
        int bookIndex = _bookCollection.indexOf(item);
        if (bookIndex >= 0) {
            mListView.setItemChecked(bookIndex, true);
            minIndex = Math.min(minIndex, bookIndex);
        }
    }
    if (minIndex < Integer.MAX_VALUE) {
        mListView.smoothScrollToPosition(minIndex);
    }
}
 
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:21,代码来源:MainActivity.java

示例7: onScrollStateChanged

import android.widget.AbsListView; //导入依赖的package包/类
public void onScrollStateChanged(AbsListView view, int scrollState) {
    switch (scrollState) {
        case 0:
            this.imageLoader.resume();
            break;
        case 1:
            if (this.pauseOnScroll) {
                this.imageLoader.pause();
                break;
            }
            break;
        case 2:
            if (this.pauseOnFling) {
                this.imageLoader.pause();
                break;
            }
            break;
    }
    if (this.externalListener != null) {
        this.externalListener.onScrollStateChanged(view, scrollState);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:PauseOnScrollListener.java

示例8: canChildScrollUp

import android.widget.AbsListView; //导入依赖的package包/类
/**
 * 用来判断是否可以下拉
 */
public static boolean canChildScrollUp(View mChildView) {
    if (mChildView == null) {
        return false;
    }
    if (Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(mChildView, -1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, -1);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ScrollingUtil.java

示例9: getAllCanScrollView

import android.widget.AbsListView; //导入依赖的package包/类
/**
 * 递归遍历子view,记录所有的AbsListView, ScrollView
 *
 * @param absListViews
 * @param parent
 */
private void getAllCanScrollView(List<AbsListView> absListViews,
                                    List<ScrollView> scrollViews,
                                    ViewGroup parent) {
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        if (child instanceof AbsListView) {
            absListViews.add((AbsListView) child);
        } else if (child instanceof ScrollView) {
            scrollViews.add((ScrollView) child);
        } else {
            if (child instanceof ViewGroup) {
                // 递归遍历子View
                getAllCanScrollView(absListViews, scrollViews, (ViewGroup) child);
            }
        }
    }
}
 
开发者ID:lorienzhang,项目名称:SwipeFinishLayout,代码行数:25,代码来源:SwipeFinishLayout.java

示例10: scrollToTop

import android.widget.AbsListView; //导入依赖的package包/类
private static boolean scrollToTop(View view) {
    if (Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getChildCount() - 1
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom() > absListView.getPaddingBottom());
        } else {
            return ViewCompat.canScrollVertically(view, 1) || view.getScrollY() < 0;
        }
    } else {
        return ViewCompat.canScrollVertically(view, 1);
    }
}
 
开发者ID:anmingyu11,项目名称:OverScrollableRecyclerView-Method1,代码行数:15,代码来源:ScrollerUtil.java

示例11: fling

import android.widget.AbsListView; //导入依赖的package包/类
@Override
public void fling(int velocity) {
    if (mScrollableView instanceof ScrollView) {
        ((ScrollView) mScrollableView).fling(velocity);
    } else if (mScrollableView instanceof AbsListView) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ((AbsListView) mScrollableView).fling(velocity);
        }
    } else if (mScrollableView instanceof WebView) {
        ((WebView) mScrollableView).flingScroll(0, velocity);
    } else if (mScrollableView instanceof RecyclerView) {
        ((RecyclerView) mScrollableView).fling(0, velocity);
    } else if (mScrollableView instanceof NestedScrollView) {
        ((NestedScrollView) mScrollableView).fling(velocity);
    }
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:17,代码来源:RefreshContentWrapper.java

示例12: onItemLongClick

import android.widget.AbsListView; //导入依赖的package包/类
@Override
public boolean onItemLongClick(AdapterView<?> view, View row,
                               int position, long id) {

    if (mMode == null) {
        getGridView().setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
        getGridView().invalidateViews();
        mMode = mContext.startSupportActionMode(this);
    } else {
        getGridView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
        getGridView().invalidateViews();
        mMode.finish();
    }

    return (true);
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:17,代码来源:LibraryMaterialFragment.java

示例13: onScrollStateChanged

import android.widget.AbsListView; //导入依赖的package包/类
/**
 * 当滚动状态改变时回调
 */
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if (onScrollListener != null) {
        onScrollListener.onScrollStateChanged(view, scrollState);
    }

    if (scrollState == SCROLL_STATE_IDLE || scrollState == SCROLL_STATE_FLING) {
        // 判断当前是否已经到了底部
        if (footerView != null)
            if (isScrollToBottom && !isLoadingMore) {
                isLoadingMore = true;
                // 当前到底部
                Log.i(TAG, "加载更多数据");
                footerView.setPadding(0, 0, 0, 0);
                listView.setSelection(listView.getCount());

                if (mOnRefershListener != null) {
                    mOnRefershListener.onLoadingMore();
                }
            }
    }
}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:26,代码来源:ListViewRefresh.java

示例14: canChildScrollUp

import android.widget.AbsListView; //导入依赖的package包/类
public static boolean canChildScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return view.getScrollY() > 0;
        }
    } else {
        return view.canScrollVertically(-1);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:PtrDefaultHandler.java

示例15: onScroll

import android.widget.AbsListView; //导入依赖的package包/类
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                     int totalItemCount) {
    mCurrentFirstVisibleItem = firstVisibleItem;
    mCurrentVisibleItemCount = visibleItemCount;

    mPreviousFirstVisibleItem = (mPreviousFirstVisibleItem == -1) ? mCurrentFirstVisibleItem
            : mPreviousFirstVisibleItem;
    mPreviousVisibleItemCount = (mPreviousVisibleItemCount == -1) ? mCurrentVisibleItemCount
            : mPreviousVisibleItemCount;

    checkAndHandleFirstVisibleCellChange();
    checkAndHandleLastVisibleCellChange();

    mPreviousFirstVisibleItem = mCurrentFirstVisibleItem;
    mPreviousVisibleItemCount = mCurrentVisibleItemCount;
    if (isPostHoneycomb() && mWobbleInEditMode) {
        updateWobbleState(visibleItemCount);
    }
    if (mUserScrollListener != null) {
        mUserScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
    }
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:23,代码来源:DynamicGridView.java


注:本文中的android.widget.AbsListView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。