當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。