当前位置: 首页>>代码示例>>Java>>正文


Java View.getRight方法代码示例

本文整理汇总了Java中android.view.View.getRight方法的典型用法代码示例。如果您正苦于以下问题:Java View.getRight方法的具体用法?Java View.getRight怎么用?Java View.getRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.getRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canScroll

import android.view.View; //导入方法依赖的package包/类
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx     Delta scrolled in pixels along the X axis
 * @param dy     Delta scrolled in pixels along the Y axis
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int dy, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
                    y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
                    canScroll(child, true, dx, dy, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && (ViewCompat.canScrollHorizontally(v, -dx) ||
            ViewCompat.canScrollVertically(v, -dy));
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:36,代码来源:ViewDragHelper.java

示例2: calcOffset

import android.view.View; //导入方法依赖的package包/类
private void calcOffset() {
        final View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
        mCurrentP.left = currentTabView.getLeft();
        mCurrentP.right = currentTabView.getRight();

        final View lastTabView = mTabsContainer.getChildAt(this.mLastTab);
        mLastP.left = lastTabView.getLeft();
        mLastP.right = lastTabView.getRight();

//        Log.d("AAA", "mLastP--->" + mLastP.left + "&" + mLastP.right);
//        Log.d("AAA", "mCurrentP--->" + mCurrentP.left + "&" + mCurrentP.right);
        if (mLastP.left == mCurrentP.left && mLastP.right == mCurrentP.right) {
            invalidate();
        } else {
            mValueAnimator.setObjectValues(mLastP, mCurrentP);
            if (mIndicatorBounceEnable) {
                mValueAnimator.setInterpolator(mInterpolator);
            }

            if (mIndicatorAnimDuration < 0) {
                mIndicatorAnimDuration = mIndicatorBounceEnable ? 500 : 250;
            }
            mValueAnimator.setDuration(mIndicatorAnimDuration);
            mValueAnimator.start();
        }
    }
 
开发者ID:sunyabin,项目名称:FlycoTablayout,代码行数:27,代码来源:SegmentTabLayout.java

示例3: roundLoad

import android.view.View; //导入方法依赖的package包/类
public void roundLoad(View myView) {
    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    // create the animator for this view (the start radius is zero)
    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());

    Animator anim1 = ObjectAnimator.ofFloat(myView, "translationZ", 0f, 50f);
    anim1.setDuration(1500);
    anim1.setInterpolator(new AccelerateInterpolator());

    animatorSet.play(anim).with(anim1);
    // make the view visible and start the animation
    myView.setVisibility(View.VISIBLE);
    animatorSet.start();
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:23,代码来源:BaseLoginLayout1.java

示例4: drawHorizontal

import android.view.View; //导入方法依赖的package包/类
/**
 * 画横向列表的分割线
 */
public void drawHorizontal(Canvas c, RecyclerView parent) {
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);

        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivideHeight;
        final int top = child.getTop() - params.topMargin;
        final int bottom = child.getBottom() + params.bottomMargin;

        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:20,代码来源:DividerGridItemDecoration.java

示例5: canScrollHorizontal

import android.view.View; //导入方法依赖的package包/类
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx     Delta scrolled in pixels
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScrollHorizontal(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight()
                    && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()
                    && canScrollHorizontal(child, true, dx, x + scrollX - child.getLeft(),
                    y + scrollY - child.getTop())) {
                return true;
            }
        }
    }
    return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:31,代码来源:YViewPager.java

示例6: drawHorizontal

import android.view.View; //导入方法依赖的package包/类
/**
 * 绘制横向水平分割线
 */
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
    int top = parent.getPaddingTop();
    int bottom = parent.getMeasuredHeight() - parent.getPaddingBottom();
    int childSize = parent.getChildCount();
    for (int i = 0; i < childSize; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
        int left = child.getRight() + layoutParams.rightMargin;
        int right = left + mDividerWidth;

        if (mDividerDrawable != null) {
            //如果是图片分割线,绘制图片
            mDividerDrawable.setBounds(left, top, right, bottom);
            canvas.drawPaint(mPaint);
            mDividerDrawable.draw(canvas);
        } else {
            //绘制矩形
            canvas.drawRect(left, top, right, bottom, mPaint);
        }
    }
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:25,代码来源:UIDivider.java

示例7: drawHorizontal

import android.view.View; //导入方法依赖的package包/类
public void drawHorizontal(Canvas c, RecyclerView parent) {
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        // 有脚部时,最后一条不画
        if (hasFooter &&
                parent.getChildLayoutPosition(child) == parent.getLayoutManager().getItemCount() - 1) {
            continue;
        }
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int left = child.getLeft() - params.leftMargin;
        final int right = child.getRight() + params.rightMargin
                + mDivider.getIntrinsicWidth();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:DividerGridItemDecoration.java

示例8: drawVertical

import android.view.View; //导入方法依赖的package包/类
public void drawVertical(Canvas c, RecyclerView parent) {
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);

        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getTop() - params.topMargin;
        final int bottom = child.getBottom() + params.bottomMargin;
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivider.getIntrinsicWidth();

        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:SupportGridItemDecoration.java

示例9: preparePositionData

import android.view.View; //导入方法依赖的package包/类
/**
 * 获取title的位置信息,为打造不同的指示器、各种效果提供可能
 */
private void preparePositionData() {
    mPositionDataList.clear();
    for (int i = 0, j = mNavigatorHelper.getTotalCount(); i < j; i++) {
        PositionData data = new PositionData();
        View v = mTitleContainer.getChildAt(i);
        if (v != null) {
            data.mLeft = v.getLeft();
            data.mTop = v.getTop();
            data.mRight = v.getRight();
            data.mBottom = v.getBottom();
            if (v instanceof IMeasurablePagerTitleView) {
                IMeasurablePagerTitleView view = (IMeasurablePagerTitleView) v;
                data.mContentLeft = view.getContentLeft();
                data.mContentTop = view.getContentTop();
                data.mContentRight = view.getContentRight();
                data.mContentBottom = view.getContentBottom();
            } else {
                data.mContentLeft = data.mLeft;
                data.mContentTop = data.mTop;
                data.mContentRight = data.mRight;
                data.mContentBottom = data.mBottom;
            }
        }
        mPositionDataList.add(data);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:CommonNavigator.java

示例10: canScroll

import android.view.View; //导入方法依赖的package包/类
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for
 *               scrollability (true), or just its children (false).
 * @param dx     Delta scrolled in pixels along the X axis
 * @param dy     Delta scrolled in pixels along the Y axis
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int dy, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance
        // first.
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft()
                    && x + scrollX < child.getRight()
                    && y + scrollY >= child.getTop()
                    && y + scrollY < child.getBottom()
                    && canScroll(child, true, dx, dy, x + scrollX - child.getLeft(), y
                    + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV
            && (ViewCompat.canScrollHorizontally(v, -dx) || ViewCompat.canScrollVertically(v,
            -dy));
}
 
开发者ID:longtaoge,项目名称:SelectName,代码行数:40,代码来源:ViewDragHelper.java

示例11: itemIsObscuredByHeader

import android.view.View; //导入方法依赖的package包/类
/**
 * Determines if an item is obscured by a header
 *
 * @param parent      it is RecyclerView
 * @param item        to determine if obscured by header
 * @param header      that might be obscuring the item
 * @param orientation of the {@link RecyclerView}
 * @return true if the item view is obscured by the header view
 */
private boolean itemIsObscuredByHeader(RecyclerView parent, View item, View header, int orientation) {
    RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) item.getLayoutParams();
    mDimensionCalculator.initMargins(mTempRect1, header);

    int adapterPosition = parent.getChildAdapterPosition(item);
    if (adapterPosition == RecyclerView.NO_POSITION || mHeaderProvider.getHeader(parent, adapterPosition) != header) {
        // Resolves https://github.com/timehop/sticky-headers-recyclerview/issues/36
        // Handles an edge case where a trailing header is smaller than the current sticky header.
        return false;
    }

    if (orientation == LinearLayoutManager.VERTICAL) {
        int itemTop = item.getTop() - layoutParams.topMargin;
        int headerBottom = header.getBottom() + mTempRect1.bottom + mTempRect1.top;
        if (itemTop > headerBottom) {
            return false;
        }
    } else {
        int itemLeft = item.getLeft() - layoutParams.leftMargin;
        int headerRight = header.getRight() + mTempRect1.right + mTempRect1.left;
        if (itemLeft > headerRight) {
            return false;
        }
    }

    return true;
}
 
开发者ID:YunzhanghuOpen,项目名称:redpacketui-open,代码行数:37,代码来源:HeaderPositionCalculator.java

示例12: drawHorizontal

import android.view.View; //导入方法依赖的package包/类
private void drawHorizontal(Canvas c, RecyclerView parent) {
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        int left = child.getLeft() - params.leftMargin;
        int top = child.getBottom() + params.bottomMargin;
        int right = child.getRight() + params.rightMargin;
        int bottom = top + mDivider.getMinimumHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
开发者ID:GitLqr,项目名称:MaterialDesignDemo,代码行数:14,代码来源:MyDecorationTwo.java

示例13: drawHorizontal

import android.view.View; //导入方法依赖的package包/类
private void drawHorizontal(Canvas c, RecyclerView parent) {
    final int top = parent.getPaddingTop();
    final int bottom = parent.getHeight() - parent.getPaddingBottom();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
开发者ID:DorianScholz,项目名称:OpenLibre,代码行数:16,代码来源:DividerItemDecoration.java

示例14: getStart

import android.view.View; //导入方法依赖的package包/类
static int getStart(View v, boolean withoutPadding) {
  if (v == null) {
    return 0;
  }
  if (isLayoutRtl(v)) {
    return (withoutPadding) ? v.getRight() - getPaddingStart(v) : v.getRight();
  } else {
    return (withoutPadding) ? v.getLeft() + getPaddingStart(v) : v.getLeft();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:Utils.java

示例15: moveSelection

import android.view.View; //导入方法依赖的package包/类
private View moveSelection(View oldSel, View newSel, int delta, int childrenLeft, int childrenRight) {
    View sel;
    int fadingEdgeLength = getHorizontalFadingEdgeLength();
    int selectedPosition = this.mSelectedPosition;
    int leftSelectionPixel = getLeftSelectionPixel(childrenLeft, fadingEdgeLength, selectedPosition);
    int rightSelectionPixel = getRightSelectionPixel(childrenLeft, fadingEdgeLength, selectedPosition);
    int halfHorizontalSpace;
    if (delta > 0) {
        oldSel = makeAndAddView(selectedPosition - 1, oldSel.getLeft(), true, this.mListPadding.top, false);
        int dividerWidth = this.mDividerWidth;
        sel = makeAndAddView(selectedPosition, oldSel.getRight() + dividerWidth, true, this.mListPadding.top, true);
        if (sel.getRight() > rightSelectionPixel) {
            halfHorizontalSpace = (childrenRight - childrenLeft) / 2;
            int offset = Math.min(Math.min(sel.getLeft() - leftSelectionPixel, sel.getRight() - rightSelectionPixel), halfHorizontalSpace);
            oldSel.offsetLeftAndRight(-offset);
            sel.offsetLeftAndRight(-offset);
        }
        if (this.mStackFromRight) {
            fillRight(this.mSelectedPosition + 1, sel.getRight() + dividerWidth);
            adjustViewsLeftOrRight();
            fillLeft(this.mSelectedPosition - 2, sel.getLeft() - dividerWidth);
        } else {
            fillLeft(this.mSelectedPosition - 2, sel.getLeft() - dividerWidth);
            adjustViewsLeftOrRight();
            fillRight(this.mSelectedPosition + 1, sel.getRight() + dividerWidth);
        }
    } else if (delta < 0) {
        if (newSel != null) {
            sel = makeAndAddView(selectedPosition, newSel.getLeft(), true, this.mListPadding.top, true);
        } else {
            sel = makeAndAddView(selectedPosition, oldSel.getLeft(), false, this.mListPadding.top, true);
        }
        if (sel.getLeft() < leftSelectionPixel) {
            halfHorizontalSpace = (childrenRight - childrenLeft) / 2;
            View view = sel;
            view.offsetLeftAndRight(Math.min(Math.min(leftSelectionPixel - sel.getLeft(), rightSelectionPixel - sel.getRight()), halfHorizontalSpace));
        }
        fillBeforeAndAfter(sel, selectedPosition);
    } else {
        int oldLeft = oldSel.getLeft();
        sel = makeAndAddView(selectedPosition, oldLeft, true, this.mListPadding.top, true);
        if (oldLeft < childrenLeft && sel.getRight() < childrenLeft + 20) {
            sel.offsetLeftAndRight(childrenLeft - sel.getLeft());
        }
        fillBeforeAndAfter(sel, selectedPosition);
    }
    return sel;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:49,代码来源:HListView.java


注:本文中的android.view.View.getRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。