android.view.View.getRight()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中android.view.View.getRight()方法的一些代码示例,展示了View.getRight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.getRight()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:getRight

View.getRight介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static Bitmap loadBitmapFromView(View v) {
  Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);                
  Canvas c = new Canvas(b);
  v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
  v.draw(c);
  return b;
}

代码示例来源:origin: H07000223/FlycoTabLayout

private void calcIndicatorRect() {
  View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
  float left = currentTabView.getLeft();
  float right = currentTabView.getRight();
  mIndicatorRect.left = (int) left;
  mIndicatorRect.right = (int) right;
  if (mIndicatorWidth < 0) {   //indicatorWidth小于0时,原jpardogo's PagerSlidingTabStrip
  } else {//indicatorWidth大于0时,圆角矩形以及三角形
    float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2;
    mIndicatorRect.left = (int) indicatorLeft;
    mIndicatorRect.right = (int) (mIndicatorRect.left + mIndicatorWidth);
  }
}

代码示例来源:origin: JorgeCastilloPrz/AndroidFillableLoaders

@Override public void transform(Canvas canvas, float currentFillPhase, View view) {
  canvas.clipRect(0, (view.getBottom() - view.getTop()) * (1f - currentFillPhase),
    view.getRight(), view.getBottom());
 }
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawBottomAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  final int left = child.getLeft() - params.leftMargin;
  final int right = child.getRight() + params.rightMargin;
  final int top = child.getBottom() + params.bottomMargin;
  final int bottom = top + drawable.getIntrinsicHeight();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawTopAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  final int left = child.getLeft() - params.leftMargin;
  final int right = child.getRight() + params.rightMargin;
  final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight();
  final int bottom = top + drawable.getIntrinsicHeight();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

@Override
  public void set(@NonNull View view, @NonNull PointF topLeft) {
    int left = Math.round(topLeft.x);
    int top = Math.round(topLeft.y);
    int right = view.getRight();
    int bottom = view.getBottom();
    ViewUtils.setLeftTopRightBottom(view, left, top, right, bottom);
  }
};

代码示例来源:origin: nickbutcher/plaid

private void captureValues(TransitionValues transitionValues) {
    final View view = transitionValues.view;
    if (view == null || view.getWidth() <= 0 || view.getHeight() <= 0) return;

    transitionValues.values.put(PROP_BOUNDS, new Rect(view.getLeft(), view.getTop(),
        view.getRight(), view.getBottom()));
  }
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawBottom(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth();
  final int right = child.getRight() + params.rightMargin + drawable.getIntrinsicWidth();
  final int top = child.getBottom() + params.bottomMargin;
  final int bottom = top + drawable.getIntrinsicHeight();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawRightAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  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 + drawable.getIntrinsicWidth();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawTop(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth();
  final int right = child.getRight() + params.rightMargin + drawable.getIntrinsicWidth();
  final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight();
  final int bottom = top + drawable.getIntrinsicHeight();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: ogaclejapan/SmartTabLayout

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();
 }
}

代码示例来源:origin: rey5137/material

private static boolean pointInView(View view, float localX, float localY, float slop) {
  return localX >= -slop && localY >= -slop &&
      localX < ((view.getRight() - view.getLeft()) + slop) &&
      localY < ((view.getBottom() - view.getTop()) + slop);
}

代码示例来源:origin: smuyyh/BookReader

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.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);
  }
}

代码示例来源:origin: smuyyh/BookReader

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);
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

protected void moveSpinner(int spinner) {
  final RefreshInternal refreshHeader = mRefreshHeader;
  if (mSpinner != spinner && refreshHeader != null) {
    mSpinner = spinner;
    switch (refreshHeader.getSpinnerStyle()) {
      case Translate:
        refreshHeader.getView().setTranslationY(spinner);
        break;
      case Scale:{
        View view = refreshHeader.getView();
        view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getTop() + Math.max(0, spinner));
        break;
      }
    }
  }
}
//</editor-fold>

代码示例来源:origin: ogaclejapan/SmartTabLayout

static int getEnd(View v, boolean withoutPadding) {
 if (v == null) {
  return 0;
 }
 if (isLayoutRtl(v)) {
  return (withoutPadding) ? v.getLeft() + getPaddingEnd(v) : v.getLeft();
 } else {
  return (withoutPadding) ? v.getRight() - getPaddingEnd(v) : v.getRight();
 }
}

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

public static Rect getViewBounds(@NonNull View v, @NonNull Rect outBounds) {
  outBounds.left = v.getLeft();
  outBounds.right = v.getRight();
  outBounds.top = v.getTop();
  outBounds.bottom = v.getBottom();
  return outBounds;
}

代码示例来源:origin: Rukey7/MvpApp

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.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);
  }
}

代码示例来源:origin: jdsjlzx/LRecyclerView

public static void drawRight(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) {
  final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight();
  final int bottom = child.getBottom() + params.bottomMargin + drawable.getIntrinsicHeight();
  final int left = child.getRight() + params.rightMargin;
  final int right = left + drawable.getIntrinsicWidth();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: H07000223/FlycoTabLayout

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();
    }
  }

相关文章

微信公众号

最新文章

更多

View类方法