当前位置: 首页>>代码示例>>C#>>正文


C# android.getParent方法代码示例

本文整理汇总了C#中android.getParent方法的典型用法代码示例。如果您正苦于以下问题:C# android.getParent方法的具体用法?C# android.getParent怎么用?C# android.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android的用法示例。


在下文中一共展示了android.getParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addViewInner

		private void addViewInner(android.view.View child, int index, android.view.ViewGroup
			.LayoutParams @params, bool preventRequestLayout)
		{
			if (mTransition != null)
			{
				// Don't prevent other add transitions from completing, but cancel remove
				// transitions to let them complete the process before we add to the container
				mTransition.cancel(android.animation.LayoutTransition.DISAPPEARING);
			}
			if (child.getParent() != null)
			{
				throw new System.InvalidOperationException("The specified child already has a parent. "
					 + "You must call removeView() on the child's parent first.");
			}
			if (mTransition != null)
			{
				mTransition.addChild(this, child);
			}
			if (!checkLayoutParams(@params))
			{
				@params = generateLayoutParams(@params);
			}
			if (preventRequestLayout)
			{
				child.mLayoutParams = @params;
			}
			else
			{
				child.setLayoutParams(@params);
			}
			if (index < 0)
			{
				index = mChildrenCount;
			}
			addInArray(child, index);
			// tell our children
			if (preventRequestLayout)
			{
				child.assignParent(this);
			}
			else
			{
				child.mParent = this;
			}
			if (child.hasFocus())
			{
				requestChildFocus(child, child.findFocus());
			}
			android.view.View.AttachInfo ai = mAttachInfo;
			if (ai != null && (mGroupFlags & FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW) == 0)
			{
				bool lastKeepOn = ai.mKeepScreenOn;
				ai.mKeepScreenOn = false;
				child.dispatchAttachedToWindow(mAttachInfo, (mViewFlags & VISIBILITY_MASK));
				if (ai.mKeepScreenOn)
				{
					needGlobalAttributesUpdate(true);
				}
				ai.mKeepScreenOn = lastKeepOn;
			}
			onViewAdded(child);
			if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE)
			{
				mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:66,代码来源:ViewGroup.cs

示例2: addItemView

		/// <summary>Add an item view at the given index.</summary>
		/// <remarks>Add an item view at the given index.</remarks>
		/// <param name="itemView">View to add</param>
		/// <param name="childIndex">Index within the parent to insert at</param>
		protected internal virtual void addItemView(android.view.View itemView, int childIndex
			)
		{
			android.view.ViewGroup currentParent = (android.view.ViewGroup)itemView.getParent
				();
			if (currentParent != null)
			{
				currentParent.removeView(itemView);
			}
			((android.view.ViewGroup)mMenuView).addView(itemView, childIndex);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:BaseMenuPresenter.cs

示例3: isViewDescendantOf

		/// <summary>Return true if child is an descendant of parent, (or equal to the parent).
		/// 	</summary>
		/// <remarks>Return true if child is an descendant of parent, (or equal to the parent).
		/// 	</remarks>
		private bool isViewDescendantOf(android.view.View child, android.view.View parent
			)
		{
			if (child == parent)
			{
				return true;
			}
			android.view.ViewParent theParent = child.getParent();
			return (theParent is android.view.ViewGroup) && isViewDescendantOf((android.view.View
				)theParent, parent);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:HorizontalScrollView.cs

示例4: onTouchEvent

		public override bool onTouchEvent(android.widget.TextView widget, android.text.Spannable
			 buffer, android.view.MotionEvent @event)
		{
			int initialScrollX = -1;
			int initialScrollY = -1;
			int action = @event.getAction();
			if (action == android.view.MotionEvent.ACTION_UP)
			{
				initialScrollX = android.text.method.Touch.getInitialScrollX(widget, buffer);
				initialScrollY = android.text.method.Touch.getInitialScrollY(widget, buffer);
			}
			bool handled = android.text.method.Touch.onTouchEvent(widget, buffer, @event);
			if (widget.isFocused() && !widget.didTouchFocusSelect())
			{
				if (action == android.view.MotionEvent.ACTION_DOWN)
				{
					if (isSelecting(buffer))
					{
						int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
						buffer.setSpan(LAST_TAP_DOWN, offset, offset, android.text.SpannedClass.SPAN_POINT_POINT
							);
						// Disallow intercepting of the touch events, so that
						// users can scroll and select at the same time.
						// without this, users would get booted out of select
						// mode once the view detected it needed to scroll.
						widget.getParent().requestDisallowInterceptTouchEvent(true);
					}
				}
				else
				{
					if (action == android.view.MotionEvent.ACTION_MOVE)
					{
						if (isSelecting(buffer) && handled)
						{
							// Before selecting, make sure we've moved out of the "slop".
							// handled will be true, if we're in select mode AND we're
							// OUT of the slop
							// Turn long press off while we're selecting. User needs to
							// re-tap on the selection to enable long press
							widget.cancelLongPress();
							// Update selection as we're moving the selection area.
							// Get the current touch position
							int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
							android.text.Selection.extendSelection(buffer, offset);
							return true;
						}
					}
					else
					{
						if (action == android.view.MotionEvent.ACTION_UP)
						{
							// If we have scrolled, then the up shouldn't move the cursor,
							// but we do need to make sure the cursor is still visible at
							// the current scroll offset to avoid the scroll jumping later
							// to show it.
							if ((initialScrollY >= 0 && initialScrollY != widget.getScrollY()) || (initialScrollX
								 >= 0 && initialScrollX != widget.getScrollX()))
							{
								widget.moveCursorToVisibleOffset();
								return true;
							}
							int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
							if (isSelecting(buffer))
							{
								buffer.removeSpan(LAST_TAP_DOWN);
								android.text.Selection.extendSelection(buffer, offset);
							}
							else
							{
								if (!widget.shouldIgnoreActionUpEvent())
								{
									android.text.Selection.setSelection(buffer, offset);
								}
							}
							android.text.method.MetaKeyKeyListener.adjustMetaAfterKeypress(buffer);
							android.text.method.MetaKeyKeyListener.resetLockedMeta(buffer);
							return true;
						}
					}
				}
			}
			return handled;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:83,代码来源:ArrowKeyMovementMethod.cs

示例5: while

		public virtual android.view.WindowManagerClass.LayoutParams getRootViewLayoutParameter
			(android.view.View view)
		{
			android.view.ViewParent vp = view.getParent();
			while (vp != null && !(vp is android.view.ViewRootImpl))
			{
				vp = vp.getParent();
			}
			if (vp == null)
			{
				return null;
			}
			android.view.ViewRootImpl vr = (android.view.ViewRootImpl)vp;
			int N = mRoots.Length;
			{
				for (int i = 0; i < N; ++i)
				{
					if (mRoots[i] == vr)
					{
						return mParams[i];
					}
				}
			}
			return null;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:25,代码来源:WindowManagerImpl.cs

示例6: invalidateGlobalRegion

			internal virtual void invalidateGlobalRegion(android.view.View v, android.graphics.Rect
				 r)
			{
				// We need to make a new rect here, so as not to modify the one passed
				this.globalInvalidateRect.set(r);
				this.globalInvalidateRect.union(0, 0, this._enclosing.getWidth(), this._enclosing
					.getHeight());
				android.view.View p = v;
				if (!(v.getParent() != null && v.getParent() is android.view.View))
				{
					return;
				}
				bool firstPass = true;
				this.parentRect.set(0, 0, 0, 0);
				while (p.getParent() != null && p.getParent() is android.view.View && !this.parentRect
					.contains(this.globalInvalidateRect))
				{
					if (!firstPass)
					{
						this.globalInvalidateRect.offset(p.getLeft() - p.getScrollX(), p.getTop() - p.getScrollY
							());
					}
					firstPass = false;
					p = (android.view.View)p.getParent();
					this.parentRect.set(p.getScrollX(), p.getScrollY(), p.getWidth() + p.getScrollX()
						, p.getHeight() + p.getScrollY());
					p.invalidate(this.globalInvalidateRect.left, this.globalInvalidateRect.top, this.
						globalInvalidateRect.right, this.globalInvalidateRect.bottom);
				}
				p.invalidate(this.globalInvalidateRect.left, this.globalInvalidateRect.top, this.
					globalInvalidateRect.right, this.globalInvalidateRect.bottom);
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:32,代码来源:StackView.cs


注:本文中的android.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。