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


C# android.getY方法代码示例

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


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

示例1: dispatchTouchEvent

		public override bool dispatchTouchEvent(android.view.MotionEvent ev)
		{
			if (mDefaultTouchRecepient == null)
			{
				return base.dispatchTouchEvent(ev);
			}
			if (base.dispatchTouchEvent(ev))
			{
				return true;
			}
			mTempRect.set(0, 0, 0, 0);
			offsetRectIntoDescendantCoords(mDefaultTouchRecepient, mTempRect);
			ev.setLocation(ev.getX() + mTempRect.left, ev.getY() + mTempRect.top);
			return mDefaultTouchRecepient.dispatchTouchEvent(ev);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:LinearLayoutWithDefaultTouchRecepient.cs

示例2: onInterceptTouchEvent

		public override bool onInterceptTouchEvent(android.view.MotionEvent ev)
		{
			int action = ev.getAction();
			if ((action == android.view.MotionEvent.ACTION_MOVE) && (mIsBeingDragged))
			{
				return true;
			}
			switch (action & android.view.MotionEvent.ACTION_MASK)
			{
				case android.view.MotionEvent.ACTION_MOVE:
				{
					int activePointerId = mActivePointerId;
					if (activePointerId == INVALID_POINTER)
					{
						// If we don't have a valid id, the touch down wasn't on content.
						break;
					}
					int pointerIndex = ev.findPointerIndex(activePointerId);
					float x = ev.getX(pointerIndex);
					int xDiff = (int)System.Math.Abs(x - mLastMotionX);
					if (xDiff > mTouchSlop)
					{
						mIsBeingDragged = true;
						mLastMotionX = x;
						initVelocityTrackerIfNotExists();
						mVelocityTracker.addMovement(ev);
						if (mParent != null)
						{
							mParent.requestDisallowInterceptTouchEvent(true);
						}
					}
					break;
				}

				case android.view.MotionEvent.ACTION_DOWN:
				{
					float x = ev.getX();
					if (!inChild((int)x, (int)ev.getY()))
					{
						mIsBeingDragged = false;
						recycleVelocityTracker();
						break;
					}
					mLastMotionX = x;
					mActivePointerId = ev.getPointerId(0);
					initOrResetVelocityTracker();
					mVelocityTracker.addMovement(ev);
					mIsBeingDragged = !mScroller.isFinished();
					break;
				}

				case android.view.MotionEvent.ACTION_CANCEL:
				case android.view.MotionEvent.ACTION_UP:
				{
					mIsBeingDragged = false;
					mActivePointerId = INVALID_POINTER;
					if (mScroller.springBack(mScrollX, mScrollY, 0, getScrollRange(), 0, 0))
					{
						invalidate();
					}
					break;
				}

				case android.view.MotionEvent.ACTION_POINTER_DOWN:
				{
					int index = ev.getActionIndex();
					mLastMotionX = ev.getX(index);
					mActivePointerId = ev.getPointerId(index);
					break;
				}

				case android.view.MotionEvent.ACTION_POINTER_UP:
				{
					onSecondaryPointerUp(ev);
					mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
					break;
				}
			}
			return mIsBeingDragged;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:80,代码来源:HorizontalScrollView.cs

示例3: isConsideredDoubleTap

		private bool isConsideredDoubleTap(android.view.MotionEvent firstDown, android.view.MotionEvent
			 firstUp, android.view.MotionEvent secondDown)
		{
			if (!mAlwaysInBiggerTapRegion)
			{
				return false;
			}
			if (secondDown.getEventTime() - firstUp.getEventTime() > DOUBLE_TAP_TIMEOUT)
			{
				return false;
			}
			int deltaX = (int)firstDown.getX() - (int)secondDown.getX();
			int deltaY = (int)firstDown.getY() - (int)secondDown.getY();
			return (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:GestureDetector.cs

示例4: onTouch

			public virtual bool onTouch(android.view.View v, android.view.MotionEvent @event)
			{
				int action = @event.getAction();
				int x = (int)@event.getX();
				int y = (int)@event.getY();
				if (action == android.view.MotionEvent.ACTION_DOWN && this._enclosing.mPopup != null
					 && this._enclosing.mPopup.isShowing() && (x >= 0 && x < this._enclosing.mPopup.
					getWidth() && y >= 0 && y < this._enclosing.mPopup.getHeight()))
				{
					this._enclosing.mHandler.postDelayed(this._enclosing.mResizePopupRunnable, android.widget.ListPopupWindow
						.EXPAND_LIST_TIMEOUT);
				}
				else
				{
					if (action == android.view.MotionEvent.ACTION_UP)
					{
						this._enclosing.mHandler.removeCallbacks(this._enclosing.mResizePopupRunnable);
					}
				}
				return false;
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:21,代码来源:ListPopupWindow.cs

示例5: dispatchGenericPointerEvent

		protected internal override bool dispatchGenericPointerEvent(android.view.MotionEvent
			 @event)
		{
			// Send the event to the child under the pointer.
			int childrenCount = mChildrenCount;
			if (childrenCount != 0)
			{
				android.view.View[] children = mChildren;
				float x = @event.getX();
				float y = @event.getY();
				{
					for (int i = childrenCount - 1; i >= 0; i--)
					{
						android.view.View child = children[i];
						if (!canViewReceivePointerEvents(child) || !isTransformedTouchPointInView(x, y, child
							, null))
						{
							continue;
						}
						if (dispatchTransformedGenericPointerEvent(@event, child))
						{
							return true;
						}
					}
				}
			}
			// No child handled the event.  Send it to this view group.
			return base.dispatchGenericPointerEvent(@event);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:29,代码来源:ViewGroup.cs

示例6: onDown

		public virtual bool onDown(android.view.MotionEvent e)
		{
			// Kill any existing fling/scroll
			mFlingRunnable.stop(false);
			// Get the item's view that was touched
			mDownTouchPosition = pointToPosition((int)e.getX(), (int)e.getY());
			if (mDownTouchPosition >= 0)
			{
				mDownTouchView = getChildAt(mDownTouchPosition - mFirstPosition);
				mDownTouchView.setPressed(true);
			}
			// Reset the multiple-scroll tracking state
			mIsFirstScroll = true;
			// Must return true to get matching events for this down event.
			return true;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:Gallery.cs

示例7: getRawY

		/// <summary>MotionEvent has no getRawY(int) method; simulate it pending future API approval.
		/// 	</summary>
		/// <remarks>MotionEvent has no getRawY(int) method; simulate it pending future API approval.
		/// 	</remarks>
		private static float getRawY(android.view.MotionEvent @event, int pointerIndex)
		{
			if (pointerIndex < 0)
			{
				return float.MinValue;
			}
			if (pointerIndex == 0)
			{
				return @event.getRawY();
			}
			float offset = @event.getRawY() - @event.getY();
			return @event.getY(pointerIndex) + offset;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:17,代码来源:ScaleGestureDetector.cs

示例8: onTouchEvent

		public override bool onTouchEvent(android.view.MotionEvent ev)
		{
			if (!isEnabled())
			{
				return false;
			}
			if (mVelocityTracker == null)
			{
				mVelocityTracker = android.view.VelocityTracker.obtain();
			}
			mVelocityTracker.addMovement(ev);
			int action = ev.getActionMasked();
			switch (action)
			{
				case android.view.MotionEvent.ACTION_MOVE:
				{
					float currentMoveY = ev.getY();
					if (mBeginEditOnUpEvent || mScrollState != android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL)
					{
						int deltaDownY = (int)System.Math.Abs(currentMoveY - mLastDownEventY);
						if (deltaDownY > mTouchSlop)
						{
							mBeginEditOnUpEvent = false;
							onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL
								);
						}
					}
					int deltaMoveY = (int)(currentMoveY - mLastMotionEventY);
					scrollBy(0, deltaMoveY);
					invalidate();
					mLastMotionEventY = currentMoveY;
					break;
				}

				case android.view.MotionEvent.ACTION_UP:
				{
					if (mBeginEditOnUpEvent)
					{
						setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
						showInputControls(mShowInputControlsAnimimationDuration);
						mInputText.requestFocus();
						return true;
					}
					android.view.VelocityTracker velocityTracker = mVelocityTracker;
					velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
					int initialVelocity = (int)velocityTracker.getYVelocity();
					if (System.Math.Abs(initialVelocity) > mMinimumFlingVelocity)
					{
						fling(initialVelocity);
						onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_FLING
							);
					}
					else
					{
						if (mAdjustScrollerOnUpEvent)
						{
							if (mFlingScroller.isFinished() && mAdjustScroller.isFinished())
							{
								postAdjustScrollerCommand(0);
							}
						}
						else
						{
							postAdjustScrollerCommand(SHOW_INPUT_CONTROLS_DELAY_MILLIS);
						}
					}
					mVelocityTracker.recycle();
					mVelocityTracker = null;
					break;
				}
			}
			return true;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:73,代码来源:NumberPicker.cs

示例9: onInterceptTouchEvent

		public override bool onInterceptTouchEvent(android.view.MotionEvent ev)
		{
			int action = ev.getAction();
			switch (action & android.view.MotionEvent.ACTION_MASK)
			{
				case android.view.MotionEvent.ACTION_DOWN:
				{
					if (mActivePointerId == INVALID_POINTER)
					{
						mInitialX = ev.getX();
						mInitialY = ev.getY();
						mActivePointerId = ev.getPointerId(0);
					}
					break;
				}

				case android.view.MotionEvent.ACTION_MOVE:
				{
					int pointerIndex = ev.findPointerIndex(mActivePointerId);
					if (pointerIndex == INVALID_POINTER)
					{
						// no data for our primary pointer, this shouldn't happen, log it
						android.util.Log.d(TAG, "Error: No data for our primary pointer.");
						return false;
					}
					float newY = ev.getY(pointerIndex);
					float deltaY = newY - mInitialY;
					beginGestureIfNeeded(deltaY);
					break;
				}

				case android.view.MotionEvent.ACTION_POINTER_UP:
				{
					onSecondaryPointerUp(ev);
					break;
				}

				case android.view.MotionEvent.ACTION_UP:
				case android.view.MotionEvent.ACTION_CANCEL:
				{
					mActivePointerId = INVALID_POINTER;
					mSwipeGestureType = GESTURE_NONE;
					break;
				}
			}
			return mSwipeGestureType != GESTURE_NONE;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:47,代码来源:StackView.cs

示例10: onSecondaryPointerUp

		private void onSecondaryPointerUp(android.view.MotionEvent ev)
		{
			int pointerIndex = (ev.getAction() & android.view.MotionEvent.ACTION_POINTER_INDEX_MASK
				) >> android.view.MotionEvent.ACTION_POINTER_INDEX_SHIFT;
			int pointerId = ev.getPointerId(pointerIndex);
			if (pointerId == mActivePointerId)
			{
				// This was our active pointer going up. Choose a new
				// active pointer and adjust accordingly.
				// TODO: Make this decision more intelligent.
				int newPointerIndex = pointerIndex == 0 ? 1 : 0;
				mLastMotionY = ev.getY(newPointerIndex);
				mActivePointerId = ev.getPointerId(newPointerIndex);
				if (mVelocityTracker != null)
				{
					mVelocityTracker.clear();
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:19,代码来源:ScrollView.cs

示例11: onTouchEvent

		public override bool onTouchEvent(android.view.MotionEvent ev)
		{
			initVelocityTrackerIfNotExists();
			mVelocityTracker.addMovement(ev);
			int action = ev.getAction();
			switch (action & android.view.MotionEvent.ACTION_MASK)
			{
				case android.view.MotionEvent.ACTION_DOWN:
				{
					mIsBeingDragged = getChildCount() != 0;
					if (!mIsBeingDragged)
					{
						return false;
					}
					if (!mScroller.isFinished())
					{
						mScroller.abortAnimation();
						if (mFlingStrictSpan != null)
						{
							mFlingStrictSpan.finish();
							mFlingStrictSpan = null;
						}
					}
					// Remember where the motion event started
					mLastMotionY = ev.getY();
					mActivePointerId = ev.getPointerId(0);
					break;
				}

				case android.view.MotionEvent.ACTION_MOVE:
				{
					if (mIsBeingDragged)
					{
						// Scroll to follow the motion event
						int activePointerIndex = ev.findPointerIndex(mActivePointerId);
						float y = ev.getY(activePointerIndex);
						int deltaY = (int)(mLastMotionY - y);
						mLastMotionY = y;
						int oldX = mScrollX;
						int oldY = mScrollY;
						int range = getScrollRange();
						int overscrollMode = getOverScrollMode();
						bool canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS || (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS
							 && range > 0);
						if (overScrollBy(0, deltaY, 0, mScrollY, 0, range, 0, mOverscrollDistance, true))
						{
							// Break our velocity if we hit a scroll barrier.
							mVelocityTracker.clear();
						}
						onScrollChanged(mScrollX, mScrollY, oldX, oldY);
						if (canOverscroll)
						{
							int pulledToY = oldY + deltaY;
							if (pulledToY < 0)
							{
								mEdgeGlowTop.onPull((float)deltaY / getHeight());
								if (!mEdgeGlowBottom.isFinished())
								{
									mEdgeGlowBottom.onRelease();
								}
							}
							else
							{
								if (pulledToY > range)
								{
									mEdgeGlowBottom.onPull((float)deltaY / getHeight());
									if (!mEdgeGlowTop.isFinished())
									{
										mEdgeGlowTop.onRelease();
									}
								}
							}
							if (mEdgeGlowTop != null && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished
								()))
							{
								invalidate();
							}
						}
					}
					break;
				}

				case android.view.MotionEvent.ACTION_UP:
				{
					if (mIsBeingDragged)
					{
						android.view.VelocityTracker velocityTracker = mVelocityTracker;
						velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
						int initialVelocity = (int)velocityTracker.getYVelocity(mActivePointerId);
						if (getChildCount() > 0)
						{
							if ((System.Math.Abs(initialVelocity) > mMinimumVelocity))
							{
								fling(-initialVelocity);
							}
							else
							{
								if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0, getScrollRange()))
								{
									invalidate();
//.........这里部分代码省略.........
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:ScrollView.cs

示例12: onInterceptTouchEvent

		public override bool onInterceptTouchEvent(android.view.MotionEvent ev)
		{
			int action = ev.getAction();
			if ((action == android.view.MotionEvent.ACTION_MOVE) && (mIsBeingDragged))
			{
				return true;
			}
			switch (action & android.view.MotionEvent.ACTION_MASK)
			{
				case android.view.MotionEvent.ACTION_MOVE:
				{
					int activePointerId = mActivePointerId;
					if (activePointerId == INVALID_POINTER)
					{
						// If we don't have a valid id, the touch down wasn't on content.
						break;
					}
					int pointerIndex = ev.findPointerIndex(activePointerId);
					float y = ev.getY(pointerIndex);
					int yDiff = (int)System.Math.Abs(y - mLastMotionY);
					if (yDiff > mTouchSlop)
					{
						mIsBeingDragged = true;
						mLastMotionY = y;
						initVelocityTrackerIfNotExists();
						mVelocityTracker.addMovement(ev);
						if (mScrollStrictSpan == null)
						{
							mScrollStrictSpan = android.os.StrictMode.enterCriticalSpan("ScrollView-scroll");
						}
					}
					break;
				}

				case android.view.MotionEvent.ACTION_DOWN:
				{
					float y = ev.getY();
					if (!inChild((int)ev.getX(), (int)y))
					{
						mIsBeingDragged = false;
						recycleVelocityTracker();
						break;
					}
					mLastMotionY = y;
					mActivePointerId = ev.getPointerId(0);
					initOrResetVelocityTracker();
					mVelocityTracker.addMovement(ev);
					mIsBeingDragged = !mScroller.isFinished();
					if (mIsBeingDragged && mScrollStrictSpan == null)
					{
						mScrollStrictSpan = android.os.StrictMode.enterCriticalSpan("ScrollView-scroll");
					}
					break;
				}

				case android.view.MotionEvent.ACTION_CANCEL:
				case android.view.MotionEvent.ACTION_UP:
				{
					mIsBeingDragged = false;
					mActivePointerId = INVALID_POINTER;
					recycleVelocityTracker();
					if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0, getScrollRange()))
					{
						invalidate();
					}
					break;
				}

				case android.view.MotionEvent.ACTION_POINTER_UP:
				{
					onSecondaryPointerUp(ev);
					break;
				}
			}
			return mIsBeingDragged;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:76,代码来源:ScrollView.cs

示例13: onTouchEvent

		internal virtual bool onTouchEvent(android.view.MotionEvent me)
		{
			if (mState == STATE_NONE)
			{
				return false;
			}
			int action = me.getAction();
			if (action == android.view.MotionEvent.ACTION_DOWN)
			{
				if (isPointInside(me.getX(), me.getY()))
				{
					if (!mList.isInScrollingContainer())
					{
						beginDrag();
						return true;
					}
					mInitialTouchY = me.getY();
					startPendingDrag();
				}
			}
			else
			{
				if (action == android.view.MotionEvent.ACTION_UP)
				{
					// don't add ACTION_CANCEL here
					if (mPendingDrag)
					{
						// Allow a tap to scroll.
						beginDrag();
						int viewHeight = mList.getHeight();
						// Jitter
						int newThumbY = (int)me.getY() - mThumbH + 10;
						if (newThumbY < 0)
						{
							newThumbY = 0;
						}
						else
						{
							if (newThumbY + mThumbH > viewHeight)
							{
								newThumbY = viewHeight - mThumbH;
							}
						}
						mThumbY = newThumbY;
						scrollTo((float)mThumbY / (viewHeight - mThumbH));
						cancelPendingDrag();
					}
					// Will hit the STATE_DRAGGING check below
					if (mState == STATE_DRAGGING)
					{
						if (mList != null)
						{
							// ViewGroup does the right thing already, but there might
							// be other classes that don't properly reset on touch-up,
							// so do this explicitly just in case.
							mList.requestDisallowInterceptTouchEvent(false);
							mList.reportScrollStateChange(android.widget.AbsListView.OnScrollListenerClass.SCROLL_STATE_IDLE
								);
						}
						setState(STATE_VISIBLE);
						android.os.Handler handler = mHandler;
						handler.removeCallbacks(mScrollFade);
						if (!mAlwaysShow)
						{
							handler.postDelayed(mScrollFade, 1000);
						}
						mList.invalidate();
						return true;
					}
				}
				else
				{
					if (action == android.view.MotionEvent.ACTION_MOVE)
					{
						if (mPendingDrag)
						{
							float y = me.getY();
							if (System.Math.Abs(y - mInitialTouchY) > mScaledTouchSlop)
							{
								setState(STATE_DRAGGING);
								if (mListAdapter == null && mList != null)
								{
									getSectionsFromIndexer();
								}
								if (mList != null)
								{
									mList.requestDisallowInterceptTouchEvent(true);
									mList.reportScrollStateChange(android.widget.AbsListView.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL
										);
								}
								cancelFling();
								cancelPendingDrag();
							}
						}
						// Will hit the STATE_DRAGGING check below
						if (mState == STATE_DRAGGING)
						{
							int viewHeight = mList.getHeight();
							// Jitter
							int newThumbY = (int)me.getY() - mThumbH + 10;
//.........这里部分代码省略.........
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:FastScroller.cs

示例14: onInterceptTouchEvent

		internal virtual bool onInterceptTouchEvent(android.view.MotionEvent ev)
		{
			switch (ev.getActionMasked())
			{
				case android.view.MotionEvent.ACTION_DOWN:
				{
					if (mState > STATE_NONE && isPointInside(ev.getX(), ev.getY()))
					{
						if (!mList.isInScrollingContainer())
						{
							beginDrag();
							return true;
						}
						mInitialTouchY = ev.getY();
						startPendingDrag();
					}
					break;
				}

				case android.view.MotionEvent.ACTION_UP:
				case android.view.MotionEvent.ACTION_CANCEL:
				{
					cancelPendingDrag();
					break;
				}
			}
			return false;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:28,代码来源:FastScroller.cs

示例15: isOutOfBounds

		private bool isOutOfBounds(android.content.Context context, android.view.MotionEvent
			 @event)
		{
			int x = (int)@event.getX();
			int y = (int)@event.getY();
			int slop = android.view.ViewConfiguration.get(context).getScaledWindowTouchSlop();
			android.view.View decorView = getDecorView();
			return (x < -slop) || (y < -slop) || (x > (decorView.getWidth() + slop)) || (y > 
				(decorView.getHeight() + slop));
		}
开发者ID:skaslev,项目名称:XobotOS,代码行数:10,代码来源:Window.cs


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