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


Java View.offsetTopAndBottom方法代碼示例

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


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

示例1: performDrag

import android.view.View; //導入方法依賴的package包/類
private float performDrag(float dy) {
    final float newPos = Math.max(0, Math.min(mCollapseOffset + dy,
            mCollapsibleHeight + mUncollapsibleHeight));
    if (newPos != mCollapseOffset) {
        dy = newPos - mCollapseOffset;
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (!lp.ignoreOffset) {
                child.offsetTopAndBottom((int) dy);
            }
        }
        final boolean isCollapsedOld = mCollapseOffset != 0;
        mCollapseOffset = newPos;
        mTopOffset += dy;
        final boolean isCollapsedNew = newPos != 0;
        if (isCollapsedOld != isCollapsedNew) {
            onCollapsedChanged(isCollapsedNew);
        }
        postInvalidateOnAnimation();
        return dy;
    }
    return 0;
}
 
開發者ID:haruue,項目名稱:OpenWithX,代碼行數:26,代碼來源:ResolverDrawerLayout.java

示例2: adjustChildrenOfUnderTopView

import android.view.View; //導入方法依賴的package包/類
private void adjustChildrenOfUnderTopView(float scrollRate) {
    int count = getChildCount();
    if (count > 1) {
        int i;
        int multiple;
        if (count == 2) {
            i = LAST_OBJECT_IN_STACK - 1;
            multiple = 1;
        } else {
            i = LAST_OBJECT_IN_STACK - 2;
            multiple = 2;
        }
        float rate = Math.abs(scrollRate);
        for (; i < LAST_OBJECT_IN_STACK; i++, multiple--) {
            View underTopView = getChildAt(i);
            int offset = (int) (yOffsetStep * (multiple - rate));
            underTopView.offsetTopAndBottom(offset - underTopView.getTop() + initTop);
            underTopView.setScaleX(1 - SCALE_STEP * multiple + SCALE_STEP * rate);
            underTopView.setScaleY(1 - SCALE_STEP * multiple + SCALE_STEP * rate);
        }
    }
}
 
開發者ID:marven88cn,項目名稱:SwipeCard-,代碼行數:23,代碼來源:SwipeFlingAdapterView.java

示例3: setTargetOffsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
private void setTargetOffsetTopAndBottom(View target, int offset, boolean requiresUpdate) {
    target.bringToFront();
    //Log.e(TAG, "setTargetOffsetTopAndBottom>>target.getTop="+target.getTop());
    target.offsetTopAndBottom(offset);
        // Log.e(TAG,"setTargetOffsetTopAndBottom>>bCircleView,offset="+offset+",top="+target.getTop());
        bCurrentTargetOffsetTop = target.getTop();
    if (requiresUpdate && android.os.Build.VERSION.SDK_INT < 11) {
        invalidate();
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:11,代碼來源:LingjuSwipeUpLoadRefreshLayout.java

示例4: resolveView

import android.view.View; //導入方法依賴的package包/類
/**
 * Updates View bounds, possibly re-measuring and re-layouting it if the size changed.
 *
 * @param reactTag reactTag to lookup a View by
 * @param left left coordinate relative to parent
 * @param top top coordinate relative to parent
 * @param right right coordinate relative to parent
 * @param bottom bottom coordinate relative to parent
 */
/* package */ void updateViewBounds(int reactTag, int left, int top, int right, int bottom) {
  View view = resolveView(reactTag);
  int width = right - left;
  int height = bottom - top;
  if (view.getWidth() != width || view.getHeight() != height) {
    // size changed, we need to measure and layout the View
    view.measure(
        MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
    view.layout(left, top, right, bottom);
  } else {
    // same size, only location changed, there is a faster route.
    view.offsetLeftAndRight(left - view.getLeft());
    view.offsetTopAndBottom(top - view.getTop());
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:26,代碼來源:FlatNativeViewHierarchyManager.java

示例5: offsetChildToAnchor

import android.view.View; //導入方法依賴的package包/類
void offsetChildToAnchor(View child, int layoutDirection) {
    LayoutParams lp = (LayoutParams) child.getLayoutParams();
    if (lp.mAnchorView != null) {
        Rect anchorRect = this.mTempRect1;
        Rect childRect = this.mTempRect2;
        Rect desiredChildRect = this.mTempRect3;
        getDescendantRect(lp.mAnchorView, anchorRect);
        getChildRect(child, false, childRect);
        getDesiredAnchoredChildRect(child, layoutDirection, anchorRect, desiredChildRect);
        int dx = desiredChildRect.left - childRect.left;
        int dy = desiredChildRect.top - childRect.top;
        if (dx != 0) {
            child.offsetLeftAndRight(dx);
        }
        if (dy != 0) {
            child.offsetTopAndBottom(dy);
        }
        if (dx != 0 || dy != 0) {
            Behavior b = lp.getBehavior();
            if (b != null) {
                b.onDependentViewChanged(this, child, lp.mAnchorView);
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:26,代碼來源:CoordinatorLayout.java

示例6: adjustChildView

import android.view.View; //導入方法依賴的package包/類
private void adjustChildView(View child, int index) {
    if (index > -1 && index < MAX_VISIBLE) {
        int multiple;
        if (index > 2) multiple = 2;
        else multiple = index;
        child.offsetTopAndBottom(yOffsetStep * multiple);
        child.setScaleX(1 - SCALE_STEP * multiple);
        child.setScaleY(1 - SCALE_STEP * multiple);
    }
}
 
開發者ID:marven88cn,項目名稱:SwipeCard-,代碼行數:11,代碼來源:SwipeFlingAdapterView.java

示例7: setTargetOffsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
private void setTargetOffsetTopAndBottom(View target, int offset, boolean requiresUpdate) {
    target.bringToFront();
    //Log.e(TAG, "setTargetOffsetTopAndBottom>>target.getTop="+target.getTop());
    target.offsetTopAndBottom(offset);
    if (target == tCircleView) {
        // Log.e(TAG,"setTargetOffsetTopAndBottom>>tCircleView,offset="+offset+",top="+target.getTop());
        tCurrentTargetOffsetTop = target.getTop();
    } else {
        // Log.e(TAG,"setTargetOffsetTopAndBottom>>bCircleView,offset="+offset+",top="+target.getTop());
        bCurrentTargetOffsetTop = target.getTop();
    }
    if (requiresUpdate && android.os.Build.VERSION.SDK_INT < 11) {
        invalidate();
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:16,代碼來源:LingjuSwipeRefreshLayout.java

示例8: setupChild

import android.view.View; //導入方法依賴的package包/類
@TargetApi(11)
private void setupChild(View child, int position, int x, boolean flowDown, int childrenTop, boolean selected, boolean recycled) {
    boolean isSelected = selected && shouldShowSelector();
    boolean updateChildSelected = isSelected != child.isSelected();
    int mode = this.mTouchMode;
    boolean isPressed = mode > 0 && mode < 3 && this.mMotionPosition == position;
    boolean updateChildPressed = isPressed != child.isPressed();
    boolean needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();
    LayoutParams p = (LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = (LayoutParams) generateDefaultLayoutParams();
    }
    p.viewType = this.mAdapter.getItemViewType(position);
    if ((!recycled || p.forceAdd) && !(p.recycledHeaderFooter && p.viewType == -2)) {
        p.forceAdd = false;
        if (p.viewType == -2) {
            p.recycledHeaderFooter = true;
        }
        addViewInLayout(child, flowDown ? -1 : 0, p, true);
    } else {
        attachViewToParent(child, flowDown ? -1 : 0, p);
    }
    if (updateChildSelected) {
        child.setSelected(isSelected);
    }
    if (updateChildPressed) {
        child.setPressed(isPressed);
    }
    if (!(this.mChoiceMode == 0 || this.mCheckStates == null)) {
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        } else if (VERSION.SDK_INT >= 11) {
            child.setActivated(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        }
    }
    if (needToMeasure) {
        int childWidthSpec;
        int childHeightSpec = ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec, this.mListPadding.top + this.mListPadding.bottom, p.height);
        int lpWidth = p.width;
        if (lpWidth > 0) {
            childWidthSpec = MeasureSpec.makeMeasureSpec(lpWidth, 1073741824);
        } else {
            childWidthSpec = MeasureSpec.makeMeasureSpec(0, 0);
        }
        child.measure(childWidthSpec, childHeightSpec);
    } else {
        cleanupLayoutState(child);
    }
    int w = child.getMeasuredWidth();
    int h = child.getMeasuredHeight();
    int childLeft = flowDown ? x : x - w;
    if (needToMeasure) {
        child.layout(childLeft, childrenTop, childLeft + w, childrenTop + h);
    } else {
        child.offsetLeftAndRight(childLeft - child.getLeft());
        child.offsetTopAndBottom(childrenTop - child.getTop());
    }
    if (this.mCachingStarted && !child.isDrawingCacheEnabled()) {
        child.setDrawingCacheEnabled(true);
    }
    if (VERSION.SDK_INT >= 11 && recycled && ((LayoutParams) child.getLayoutParams()).scrappedFromPosition != position) {
        child.jumpDrawablesToCurrentState();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:65,代碼來源:HListView.java

示例9: offsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
static void offsetTopAndBottom(View view, int offset) {
    int currentTop = view.getTop();
    view.offsetTopAndBottom(offset);
    if (offset != 0) {
        ViewParent parent = view.getParent();
        if (parent instanceof View) {
            int absOffset = Math.abs(offset);
            ((View) parent).invalidate(view.getLeft(), currentTop - absOffset, view.getRight(), (view.getHeight() + currentTop) + absOffset);
            return;
        }
        view.invalidate();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:14,代碼來源:ViewCompatBase.java

示例10: offsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
static void offsetTopAndBottom(View view, int offset) {
    view.offsetTopAndBottom(offset);
    ViewParent parent = view.getParent();
    if (parent instanceof View) {
        tickleInvalidationFlag((View) parent);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:8,代碼來源:ViewCompatHC.java

示例11: offsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
public void offsetTopAndBottom(int offset) {
    if (offset != 0) {
        int childCount = MultiColumnListView.this.getChildCount();
        for (int index = 0; index < childCount; index++) {
            View v = MultiColumnListView.this.getChildAt(index);
            if (v.getLeft() == this.mColumnLeft || MultiColumnListView.this.isFixedView
                    (v)) {
                v.offsetTopAndBottom(offset);
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:MultiColumnListView.java

示例12: tryOffsetChildrenTopAndBottom

import android.view.View; //導入方法依賴的package包/類
protected void tryOffsetChildrenTopAndBottom(int offset) {
    final int count = getChildCount();

    for (int i = 0; i < count; i++) {
        final View v = getChildAt(i);
        v.offsetTopAndBottom(offset);
    }
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:9,代碼來源:PLA_AbsListView.java

示例13: onLayout

import android.view.View; //導入方法依賴的package包/類
@Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    final boolean hasTabs = mTabContainer != null && mTabContainer.getVisibility() != GONE;

    if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
        final int containerHeight = getMeasuredHeight();
        final int tabHeight = mTabContainer.getMeasuredHeight();

        if ((mActionBarView.getDisplayOptions() & ActionBar.DISPLAY_SHOW_HOME) == 0) {
            // Not showing home, put tabs on top.
            final int count = getChildCount();
            for (int i = 0; i < count; i++) {
                final View child = getChildAt(i);

                if (child == mTabContainer) continue;

                if (!mActionBarView.isCollapsed()) {
                    child.offsetTopAndBottom(tabHeight);
                }
            }
            mTabContainer.layout(l, 0, r, tabHeight);
        } else {
            mTabContainer.layout(l, containerHeight - tabHeight, r, containerHeight);
        }
    }

    boolean needsInvalidate = false;
    if (mIsSplit) {
        if (mSplitBackground != null) {
            mSplitBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
            needsInvalidate = true;
        }
    } else {
        if (mBackground != null) {
            mBackground.setBounds(mActionBarView.getLeft(), mActionBarView.getTop(),
                    mActionBarView.getRight(), mActionBarView.getBottom());
            needsInvalidate = true;
        }
        if ((mIsStacked = hasTabs && mStackedBackground != null)) {
            mStackedBackground.setBounds(mTabContainer.getLeft(), mTabContainer.getTop(),
                    mTabContainer.getRight(), mTabContainer.getBottom());
            needsInvalidate = true;
        }
    }

    if (needsInvalidate) {
        invalidate();
    }
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:52,代碼來源:ActionBarContainer.java

示例14: offsetTopAndBottom

import android.view.View; //導入方法依賴的package包/類
static void offsetTopAndBottom(View view, int offset) {
    view.offsetTopAndBottom(offset);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:ViewCompatMarshmallow.java

示例15: onOffsetChild

import android.view.View; //導入方法依賴的package包/類
protected void onOffsetChild(View child, int position, int offsetLeft, int offsetTop) {
    child.offsetLeftAndRight(offsetLeft);
    child.offsetTopAndBottom(offsetTop);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:PLA_ListView.java


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