本文整理汇总了C#中android.offset方法的典型用法代码示例。如果您正苦于以下问题:C# android.offset方法的具体用法?C# android.offset怎么用?C# android.offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.offset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getChildVisibleRect
public virtual bool getChildVisibleRect(android.view.View child, android.graphics.Rect
r, android.graphics.Point offset)
{
int dx = child.mLeft - mScrollX;
int dy = child.mTop - mScrollY;
if (offset != null)
{
offset.x += dx;
offset.y += dy;
}
r.offset(dx, dy);
return r.intersect(0, 0, mRight - mLeft, mBottom - mTop) && (mParent == null || mParent
.getChildVisibleRect(this, r, offset));
}
示例2: offsetRectBetweenParentAndChild
/// <summary>
/// Helper method that offsets a rect either from parent to descendant or
/// descendant to parent.
/// </summary>
/// <remarks>
/// Helper method that offsets a rect either from parent to descendant or
/// descendant to parent.
/// </remarks>
internal virtual void offsetRectBetweenParentAndChild(android.view.View descendant
, android.graphics.Rect rect, bool offsetFromChildToParent, bool clipToBounds)
{
// already in the same coord system :)
if (descendant == this)
{
return;
}
android.view.ViewParent theParent = descendant.mParent;
// search and offset up to the parent
while ((theParent != null) && (theParent is android.view.View) && (theParent != this
))
{
if (offsetFromChildToParent)
{
rect.offset(descendant.mLeft - descendant.mScrollX, descendant.mTop - descendant.
mScrollY);
if (clipToBounds)
{
android.view.View p = (android.view.View)theParent;
rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);
}
}
else
{
if (clipToBounds)
{
android.view.View p = (android.view.View)theParent;
rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop);
}
rect.offset(descendant.mScrollX - descendant.mLeft, descendant.mScrollY - descendant
.mTop);
}
descendant = (android.view.View)theParent;
theParent = descendant.mParent;
}
// now that we are up to this view, need to offset one more time
// to get into our coordinate space
if (theParent == this)
{
if (offsetFromChildToParent)
{
rect.offset(descendant.mLeft - descendant.mScrollX, descendant.mTop - descendant.
mScrollY);
}
else
{
rect.offset(descendant.mScrollX - descendant.mLeft, descendant.mScrollY - descendant
.mTop);
}
}
else
{
throw new System.ArgumentException("parameter must be a descendant of this view");
}
}
示例3: requestChildRectangleOnScreen
public override bool requestChildRectangleOnScreen(android.view.View child, android.graphics.Rect
rectangle, bool immediate)
{
// offset into coordinate space of this scroll view
rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY
());
return scrollToChildRect(rectangle, immediate);
}
示例4: invalidateChildInParent
public virtual android.view.ViewParent invalidateChildInParent(int[] location, android.graphics.Rect
dirty)
{
if ((mPrivateFlags & DRAWN) == DRAWN || (mPrivateFlags & DRAWING_CACHE_VALID) ==
DRAWING_CACHE_VALID)
{
if ((mGroupFlags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) != FLAG_OPTIMIZE_INVALIDATE)
{
dirty.offset(location[CHILD_LEFT_INDEX] - mScrollX, location[CHILD_TOP_INDEX] - mScrollY
);
int left = mLeft;
int top = mTop;
if ((mGroupFlags & FLAG_CLIP_CHILDREN) != FLAG_CLIP_CHILDREN || dirty.intersect(0
, 0, mRight - left, mBottom - top) || (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION)
{
mPrivateFlags &= ~DRAWING_CACHE_VALID;
location[CHILD_LEFT_INDEX] = left;
location[CHILD_TOP_INDEX] = top;
if (mLayerType != LAYER_TYPE_NONE)
{
mLocalDirtyRect.union(dirty);
}
return mParent;
}
}
else
{
mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID;
location[CHILD_LEFT_INDEX] = mLeft;
location[CHILD_TOP_INDEX] = mTop;
if ((mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN)
{
dirty.set(0, 0, mRight - mLeft, mBottom - mTop);
}
else
{
// in case the dirty rect extends outside the bounds of this container
dirty.union(0, 0, mRight - mLeft, mBottom - mTop);
}
if (mLayerType != LAYER_TYPE_NONE)
{
mLocalDirtyRect.union(dirty);
}
return mParent;
}
}
return null;
}
示例5: onFocusChanged
protected internal override void onFocusChanged(bool gainFocus, int direction, android.graphics.Rect
previouslyFocusedRect)
{
base.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
int closestChildIndex = -1;
if (gainFocus && previouslyFocusedRect != null)
{
previouslyFocusedRect.offset(mScrollX, mScrollY);
// figure out which item should be selected based on previously
// focused rect
android.graphics.Rect otherRect = mTempRect;
int minDistance = int.MaxValue;
int childCount = getChildCount();
{
for (int i = 0; i < childCount; i++)
{
// only consider view's on appropriate edge of grid
if (!isCandidateSelection(i, direction))
{
continue;
}
android.view.View other = getChildAt(i);
other.getDrawingRect(otherRect);
offsetDescendantRectToMyCoords(other, otherRect);
int distance = getDistance(previouslyFocusedRect, otherRect, direction);
if (distance < minDistance)
{
minDistance = distance;
closestChildIndex = i;
}
}
}
}
if (closestChildIndex >= 0)
{
setSelection(closestChildIndex + mFirstPosition);
}
else
{
requestLayout();
}
}