admin 管理员组

文章数量: 887021


2023年12月18日发(作者:html中下拉菜单代码)

}if (mLayoutFrozen) {return;}final boolean canScrollHorizontal = ollHorizontally();final boolean canScrollVertical = ollVertically();if (canScrollHorizontal || canScrollVertical) {scrollByInternal(canScrollHorizontal ? x : 0, canScrollVertical ? y : 0, null);}}RecyclerViewboolean scrollByInternal(int x, int y, MotionEvent ev) {int unconsumedX = 0, unconsumedY = 0;int consumedX = 0, consumedY = 0;consumePendingUpdateOperations();if (mAdapter != null) {eatRequestLayout();onEnterLayoutOrScroll();ection(TRACE_SCROLL_TAG);fillRemainingScrollValues(mState);if (x != 0) {consumedX = HorizontallyBy(x, mRecycler, mState);unconsumedX = x - consumedX;}if (y != 0) {consumedY = VerticallyBy(y, mRecycler, mState);unconsumedY = y - consumedY;}tion();repositionShadowingViews();onExitLayoutOrScroll();resumeRequestLayout(false);}if (!y()) {

invalidate();}if (dispatchNestedScroll(consumedX, consumedY, unconsumedX, unconsumedY, mScrollOffset,TYPE_TOUCH)) {// Update the last touch co-ords, taking any scroll offset into accountmLastTouchX -= mScrollOffset[0];mLastTouchY -= mScrollOffset[1];if (ev != null) {Location(mScrollOffset[0], mScrollOffset[1]);}mNestedOffsets[0] += mScrollOffset[0];mNestedOffsets[1] += mScrollOffset[1];} else if (getOverScrollMode() != _SCROLL_NEVER) {if (ev != null && !Source(ev, _MOUSE)) {pullGlows((), unconsumedX, (), unconsumedY);}considerReleasingGlowsOnScroll(x, y);}if (consumedX != 0 || consumedY != 0) {dispatchOnScrolled(consumedX, consumedY);}if (!awakenScrollBars()) {invalidate();}return consumedX != 0 || consumedY != 0;}LinearLayoutManager@Overridepublic int scrollVerticallyBy(int dy, er recycler, state) {if (mOrientation == HORIZONTAL) {return 0;}return scrollBy(dy, recycler, state);

bottom = t;top = t - med;} else {top = t;bottom = t + med;}} else {top = getPaddingTop();bottom = top + oratedMeasurementInOther(view);if (tDirection == _START) {right = t;left = t - med;} else {left = t;right = t + med;}}// We calculate everything with View's bounding box (which includes decor and margins)// To calculate correct layout position, we subtract DecoratedWithMargins(view, left, top, right, bottom);if (DEBUG) {Log.d(TAG, "laid out child at position " + getPosition(view) + ", with l:"+ (left + rgin) + ", t:" + (top + gin) + ", r:"+ (right - argin) + ", b:" + (bottom - Margin));}// Consume the available space if the view is not removed OR changedif (Removed() || Changed()) {eConsumed = true;}able = usable();}StateView next(er recycler) {if (mScrapList != null) {

if (p()) {removeDetachedView(ew, false);p();} else if (urnedFromScrap()) {eturnedFromScrapFlag();}recycleViewHolderInternal(holder);}holder = null;} else {fromScrapOrHiddenOrCache = true;}}}if (holder == null) {final int offsetPosition = sitionOffset(position);if (offsetPosition < 0 || offsetPosition >= mCount()) {throw new IndexOutOfBoundsException("Inconsistency detected. Invalid item "+ "position " + position + "(offset:" + offsetPosition + ")."+ "state:" + mCount() + exceptionLabel());}final int type = mViewType(offsetPosition);// 2) Find from scrap/cache via stable ids, if existsif (bleIds()) {holder = getScrapOrCachedViewForId(mId(offsetPosition),type, dryRun);if (holder != null) {// update ion = offsetPosition;fromScrapOrHiddenOrCache = true;}}if (holder == null && mViewCacheExtension != null) {// We are NOT sending the offsetPosition because LayoutManager does not

// know View view = wForPositionAndType(this, position, type);if (view != null) {holder = getChildViewHolder(view);if (holder == null) {throw new IllegalArgumentException("getViewForPositionAndType returned"+ " a view which does not have a ViewHolder"+ exceptionLabel());} else if (Ignore()) {throw new IllegalArgumentException("getViewForPositionAndType returned"+ " a view that is ignored. You must call stopIgnoring before"+ " returning this view." + exceptionLabel());}}}if (holder == null) { // fallback to poolif (DEBUG) {Log.d(TAG, "tryGetViewHolderForPositionByDeadline("+ position + ") fetching from shared pool");}holder = getRecycledViewPool().getRecycledView(type);if (holder != null) {nternal();if (FORCE_INVALIDATE_DISPLAY_LIST) {invalidateDisplayListInt(holder);}}}if (holder == null) {long start = getNanoTime();if (deadlineNs != FOREVER_NS&& !eateInTime(type, start, deadlineNs)) {// abort - we have a deadline we can't meet

return null;}创建ViewHolderholder = ViewHolder(, type);if (ALLOW_THREAD_GAP_WORK) {// only bother finding nested RV if prefetchingRecyclerView innerView = findNestedRecyclerView(ew);if (innerView != null) {dRecyclerView = new WeakReference<>(innerView);}}long end = getNanoTime();InCreateTime(type, end - start);if (DEBUG) {Log.d(TAG, "tryGetViewHolderForPositionByDeadline created new ViewHolder");}}}// This is very ugly but the only place we can grab this information// before the View is rebound and returned to the LayoutManager for post layout ops.// We don't need this in pre-layout since the VH is not updated by the (fromScrapOrHiddenOrCache && !ayout() && OfTheFlags(_BOUNCED_FROM_HIDDEN_LIST)) {gs(0, _BOUNCED_FROM_HIDDEN_LIST);if (mpleAnimations) {int changeFlags = dapterChangeFlagsForAnimations(holder);changeFlags |= _APPEARED_IN_PRE_LAYOUT;final ItemHolderInfo info = PreLayoutInformation(mState,holder, changeFlags, odifiedPayloads());recordAnimationInfoIfBouncedHiddenView(holder, info);}}boolean bound = false;

if (ayout() && d()) {// do not update unless we absolutely have youtPosition = position;} else if (!d() || pdate() || lid()) {if (DEBUG && ved()) {throw new IllegalStateException("Removed holder should be bound and it should"+ " come here only in pre-layout. Holder: " + holder+ exceptionLabel());}final int offsetPosition = sitionOffset(position);ViewHolder数据绑定bound = tryBindViewHolderByDeadline(holder, offsetPosition, position, deadlineNs);}final Params lp = outParams();final LayoutParams rvLayoutParams;if (lp == null) {rvLayoutParams = (LayoutParams) generateDefaultLayoutParams();outParams(rvLayoutParams);} else if (!checkLayoutParams(lp)) {rvLayoutParams = (LayoutParams) generateLayoutParams(lp);outParams(rvLayoutParams);} else {rvLayoutParams = (LayoutParams) lp;}older = holder;ngInvalidate = fromScrapOrHiddenOrCache && bound;return holder;}rprivate boolean tryBindViewHolderByDeadline(ViewHolder holder, int offsetPosition,int position, long deadlineNs) {RecyclerView = ;final int viewType = mViewType();long startBindNs = getNanoTime();


本文标签: 下拉菜单 绑定 数据 作者 代码