本文整理匯總了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;
}
示例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;
}
}