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

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

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

View.getBottom介绍

暂无

代码示例

代码示例来源: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: 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 drawLeftAlignItem(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.getLeft() - params.leftMargin - drawable.getIntrinsicWidth();
  final int right = left + drawable.getIntrinsicWidth();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源:origin: chentao0707/SimplifyReader

public int getBottom() {
  //find biggest value.
  int bottom = Integer.MIN_VALUE;
  int childCount = getChildCount();
  for( int index = 0; index < childCount; ++index ){
    View v = getChildAt(index);
    if(v.getLeft() != mColumnLeft && isFixedView(v) == false )
      continue;
    bottom = bottom < v.getBottom() ? v.getBottom() : bottom;
  }
  if( bottom == Integer.MIN_VALUE )
    return mSynchedBottom;	//no child for this column..
  return bottom;
}

代码示例来源: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 drawLeft(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.getLeft() - params.leftMargin - drawable.getIntrinsicWidth();
  final int right = left + drawable.getIntrinsicWidth();
  drawable.setBounds(left, top, right, bottom);
  drawable.draw(canvas);
}

代码示例来源: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: 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: umano/AndroidSlidingUpPanel

/**
 * Determine if the supplied view is under the given point in the
 * parent view's coordinate system.
 *
 * @param view Child view of the parent to hit test
 * @param x X position to test in the parent's coordinate system
 * @param y Y position to test in the parent's coordinate system
 * @return true if the supplied view is under the given point, false otherwise
 */
public boolean isViewUnder(View view, int x, int y) {
  if (view == null) {
    return false;
  }
  return x >= view.getLeft() &&
      x < view.getRight() &&
      y >= view.getTop() &&
      y < view.getBottom();
}

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

/**
 * {@inheritDoc}
 */
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
  int count = parent.getChildCount();
  for (int i = 0; i < count; i++) {
    final View child = parent.getChildAt(i);
    final int top = child.getBottom();
    final int bottom = top + mHeight;
    int left = child.getLeft() + mLPadding;
    int right = child.getRight() - mRPadding;
    c.save();
    c.drawRect(left, top, right, bottom, mPaint);
    c.restore();
  }
}

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

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: navasmdc/MaterialDesignLibrary

@Override
  public boolean onTouch(View v, MotionEvent event) {
    if (event.getX() < view.getLeft() 
        || event.getX() >view.getRight()
        || event.getY() > view.getBottom() 
        || event.getY() < view.getTop()) {
      dismiss();
    }
    return false;
  }
});

相关文章

微信公众号

最新文章

更多

View类方法