當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewHolder.getLayoutPosition方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.ViewHolder.getLayoutPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewHolder.getLayoutPosition方法的具體用法?Java ViewHolder.getLayoutPosition怎麽用?Java ViewHolder.getLayoutPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView.ViewHolder的用法示例。


在下文中一共展示了ViewHolder.getLayoutPosition方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findHiddenNonRemovedView

import android.support.v7.widget.RecyclerView.ViewHolder; //導入方法依賴的package包/類
View findHiddenNonRemovedView(int position, int type) {
    int count = this.mHiddenViews.size();
    for (int i = 0; i < count; i++) {
        View view = (View) this.mHiddenViews.get(i);
        ViewHolder holder = this.mCallback.getChildViewHolder(view);
        if (holder.getLayoutPosition() == position && !holder.isInvalid() && !holder.isRemoved() && (type == -1 || holder.getItemViewType() == type)) {
            return view;
        }
    }
    return null;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:12,代碼來源:ChildHelper.java

示例2: layoutForPredictiveAnimations

import android.support.v7.widget.RecyclerView.ViewHolder; //導入方法依賴的package包/類
private void layoutForPredictiveAnimations(Recycler recycler, State state, int startOffset, int endOffset) {
    if (state.willRunPredictiveAnimations() && getChildCount() != 0 && !state.isPreLayout() && supportsPredictiveItemAnimations()) {
        int scrapExtraStart = 0;
        int scrapExtraEnd = 0;
        List<ViewHolder> scrapList = recycler.getScrapList();
        int scrapSize = scrapList.size();
        int firstChildPos = getPosition(getChildAt(0));
        for (int i = 0; i < scrapSize; i++) {
            ViewHolder scrap = (ViewHolder) scrapList.get(i);
            if (!scrap.isRemoved()) {
                if (((scrap.getLayoutPosition() < firstChildPos) != this.mShouldReverseLayout ? -1 : 1) == -1) {
                    scrapExtraStart += this.mOrientationHelper.getDecoratedMeasurement(scrap.itemView);
                } else {
                    scrapExtraEnd += this.mOrientationHelper.getDecoratedMeasurement(scrap.itemView);
                }
            }
        }
        this.mLayoutState.mScrapList = scrapList;
        if (scrapExtraStart > 0) {
            updateLayoutStateToFillStart(getPosition(getChildClosestToStart()), startOffset);
            this.mLayoutState.mExtra = scrapExtraStart;
            this.mLayoutState.mAvailable = 0;
            this.mLayoutState.assignPositionFromScrapList();
            fill(recycler, this.mLayoutState, state, false);
        }
        if (scrapExtraEnd > 0) {
            updateLayoutStateToFillEnd(getPosition(getChildClosestToEnd()), endOffset);
            this.mLayoutState.mExtra = scrapExtraEnd;
            this.mLayoutState.mAvailable = 0;
            this.mLayoutState.assignPositionFromScrapList();
            fill(recycler, this.mLayoutState, state, false);
        }
        this.mLayoutState.mScrapList = null;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:36,代碼來源:LinearLayoutManager.java


注:本文中的android.support.v7.widget.RecyclerView.ViewHolder.getLayoutPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。