本文整理汇总了Java中android.view.View.getBottom方法的典型用法代码示例。如果您正苦于以下问题:Java View.getBottom方法的具体用法?Java View.getBottom怎么用?Java View.getBottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getBottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canScroll
import android.view.View; //导入方法依赖的package包/类
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof ViewGroup) {
ViewGroup group = (ViewGroup) v;
int scrollX = v.getScrollX();
int scrollY = v.getScrollY();
for (int i = group.getChildCount() - 1; i >= 0; i--) {
View child = group.getChildAt(i);
if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()) {
if (canScroll(child, true, dx, (x + scrollX) - child.getLeft(), (y + scrollY) - child.getTop())) {
return true;
}
}
}
}
return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
示例2: getMostVisiblePosition
import android.view.View; //导入方法依赖的package包/类
/**
* Gets the position of the view that is most prominently displayed within the list view.
*/
public int getMostVisiblePosition() {
final int firstPosition = getFirstVisiblePosition();
final int height = getHeight();
int maxDisplayedHeight = 0;
int mostVisibleIndex = 0;
int i=0;
int bottom = 0;
while (bottom < height) {
View child = getChildAt(i);
if (child == null) {
break;
}
bottom = child.getBottom();
int displayedHeight = Math.min(bottom, height) - Math.max(0, child.getTop());
if (displayedHeight > maxDisplayedHeight) {
mostVisibleIndex = i;
maxDisplayedHeight = displayedHeight;
}
i++;
}
return firstPosition + mostVisibleIndex;
}
示例3: drawVertical
import android.view.View; //导入方法依赖的package包/类
public void drawVertical(Canvas c, RecyclerView parent) {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
android.support.v7.widget.RecyclerView v = new android.support.v7.widget.RecyclerView(parent.getContext());
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
示例4: performCircularReveal
import android.view.View; //导入方法依赖的package包/类
private void performCircularReveal(View show) {
show.setBackgroundColor(0xffff0000);
ViewCompat.setTranslationY(show, 0);
ViewCompat.setTranslationX(show, 0);
show.getLayoutParams().height = 500;
show.getLayoutParams().width = 1920;
show.requestLayout();
int centerX = (show.getLeft() + show.getRight()) / 2;
int centerY = (show.getTop() + show.getBottom()) / 2;
float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
show, centerX, centerY, 0, finalRadius);
mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
mCircularReveal.setDuration(500);
mCircularReveal.start();
}
示例5: 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
* @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 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--) {
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, x + scrollX - child.getLeft(),
y + scrollY - child.getTop())) {
return true;
}
}
}
return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
示例6: draw
import android.view.View; //导入方法依赖的package包/类
private void draw(Canvas c, RecyclerView parent) {
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin +
Math.round(ViewCompat.getTranslationY(child));
int bottom = top + mDivider.getIntrinsicHeight() + 1;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
示例7: 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);
}
}
示例8: onDrawOver
import android.view.View; //导入方法依赖的package包/类
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin;
int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
示例9: drawVertical
import android.view.View; //导入方法依赖的package包/类
private void drawVertical(@NonNull Canvas c, @NonNull RecyclerView parent) {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
RecyclerView v = new RecyclerView(parent.getContext());
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
示例10: onDrawOver
import android.view.View; //导入方法依赖的package包/类
@Override
public void onDrawOver(Canvas c, RecyclerView parent,
RecyclerView.State state) {
super.onDrawOver(c, parent, state);
// calculate left/right x-coordinates for all dividers
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
// for every item but the last, draw a line below it
for (int i = 0; i < parent.getChildCount() - 1; ++i) {
View item = parent.getChildAt(i); // get ith list item
// calculate top/bottom y-coordinates for current divider
int top = item.getBottom() + ((RecyclerView.LayoutParams)
item.getLayoutParams()).bottomMargin;
int bottom = top + divider.getIntrinsicHeight();
// draw the divider with the calculated bounds
divider.setBounds(left, top, right, bottom);
divider.draw(c);
}
}
示例11: 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
* @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 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, x + scrollX - child.getLeft(),
y + scrollY - child.getTop())) {
return true;
}
}
}
return checkV && ViewCompat.canScrollHorizontally(v, (-dx));
}
示例12: getAnimation
import android.view.View; //导入方法依赖的package包/类
/**
* This method takes some view and the values by which its top and bottom bounds
* should be changed by. Given these params, an animation which will animate
* these bound changes is created and returned.
*/
private Animator getAnimation(final View view, float translateTop, float translateBottom) {
int top = view.getTop();
int bottom = view.getBottom();
int endTop = (int)(top + translateTop);
int endBottom = (int)(bottom + translateBottom);
PropertyValuesHolder translationTop = PropertyValuesHolder.ofInt("top", top, endTop);
PropertyValuesHolder translationBottom = PropertyValuesHolder.ofInt("bottom", bottom,
endBottom);
return ObjectAnimator.ofPropertyValuesHolder(view, translationTop, translationBottom);
}
示例13: 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);
}
}
示例14: findTopChildUnder
import android.view.View; //导入方法依赖的package包/类
public View findTopChildUnder(int x, int y) {
for (int i = this.mParentView.getChildCount() - 1; i >= 0; i--) {
View child = this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(i));
if (x >= child.getLeft() && x < child.getRight() && y >= child.getTop() && y < child.getBottom()) {
return child;
}
}
return null;
}
示例15: getStickTop
import android.view.View; //导入方法依赖的package包/类
private int getStickTop() {
View view = findViewByPosition(stickPosition - 1);
if (view == null) {
view = findViewByPosition(stickPosition + 1);
if (view == null) {
return 0;
} else {
return view.getTop() - stickViewHeight;
}
} else {
return view.getBottom();
}
}