本文整理汇总了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;
}
示例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);
}
}
}
示例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();
}
}
示例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());
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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();
}
}
示例14: offsetTopAndBottom
import android.view.View; //导入方法依赖的package包/类
static void offsetTopAndBottom(View view, int offset) {
view.offsetTopAndBottom(offset);
}
示例15: onOffsetChild
import android.view.View; //导入方法依赖的package包/类
protected void onOffsetChild(View child, int position, int offsetLeft, int offsetTop) {
child.offsetLeftAndRight(offsetLeft);
child.offsetTopAndBottom(offsetTop);
}