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


C# android.translate方法代码示例

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


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

示例1: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			if (mPicture != null)
			{
				android.graphics.Rect bounds = getBounds();
				canvas.save();
				canvas.clipRect(bounds);
				canvas.translate(bounds.left, bounds.top);
				canvas.drawPicture(mPicture);
				canvas.restore();
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:12,代码来源:PictureDrawable.cs

示例2: draw

		public virtual void draw(android.graphics.Canvas canvas)
		{
			if (mDrawable == null)
			{
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mTranslationX, mTranslationY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:14,代码来源:TargetDrawable.cs

示例3: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			lock (this)
			{
				base.onDraw(canvas);
				if (mThumb != null)
				{
					canvas.save();
					// Translate the padding. For the x, we need to allow the thumb to
					// draw in its extra space
					canvas.translate(mPaddingLeft - mThumbOffset, mPaddingTop);
					mThumb.draw(canvas);
					canvas.restore();
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:AbsSeekBar.cs

示例4: drawChild


//.........这里部分代码省略.........
					if (layerType != LAYER_TYPE_NONE)
					{
						layerType = LAYER_TYPE_SOFTWARE;
						child.buildDrawingCache(true);
					}
					cache = child.getDrawingCache(true);
				}
				else
				{
					switch (layerType)
					{
						case LAYER_TYPE_SOFTWARE:
						{
							child.buildDrawingCache(true);
							cache = child.getDrawingCache(true);
							break;
						}

						case LAYER_TYPE_NONE:
						{
							// Delay getting the display list until animation-driven alpha values are
							// set up and possibly passed on to the view
							hasDisplayList = child.canHaveDisplayList();
							break;
						}
					}
				}
			}
			bool hasNoCache = cache == null || hasDisplayList;
			bool offsetForScroll = cache == null && !hasDisplayList && layerType != LAYER_TYPE_HARDWARE;
			int restoreTo = canvas.save();
			if (offsetForScroll)
			{
				canvas.translate(cl - sx, ct - sy);
			}
			else
			{
				canvas.translate(cl, ct);
				if (scalingRequired)
				{
					// mAttachInfo cannot be null, otherwise scalingRequired == false
					float scale = 1.0f / mAttachInfo.mApplicationScale;
					canvas.scale(scale, scale);
				}
			}
			if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix())
			{
				if (transformToApply != null || !childHasIdentityMatrix)
				{
					int transX = 0;
					int transY = 0;
					if (offsetForScroll)
					{
						transX = -sx;
						transY = -sy;
					}
					if (transformToApply != null)
					{
						if (concatMatrix)
						{
							// Undo the scroll translation, apply the transformation matrix,
							// then redo the scroll translate to get the correct result.
							canvas.translate(-transX, -transY);
							canvas.concat(transformToApply.getMatrix());
							canvas.translate(transX, transY);
							mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:67,代码来源:ViewGroup.cs

示例5: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			android.graphics.Rect r = getBounds();
			android.graphics.Paint paint = mShapeState.mPaint;
			int prevAlpha = paint.getAlpha();
			paint.setAlpha(modulateAlpha(prevAlpha, mShapeState.mAlpha));
			if (mShapeState.mShape != null)
			{
				// need the save both for the translate, and for the (unknown) Shape
				int count = canvas.save();
				canvas.translate(r.left, r.top);
				onDraw(mShapeState.mShape, canvas, paint);
				canvas.restoreToCount(count);
			}
			else
			{
				canvas.drawRect(r, paint);
			}
			// restore
			paint.setAlpha(prevAlpha);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:21,代码来源:ShapeDrawable.cs

示例6: draw

		/// <summary>Draw this object to the canvas using the properties defined in this class.
		/// 	</summary>
		/// <remarks>Draw this object to the canvas using the properties defined in this class.
		/// 	</remarks>
		/// <param name="canvas">canvas to draw into</param>
		public virtual void draw(android.graphics.Canvas canvas)
		{
			float threshold = 1.0f / 256.0f;
			// contribution less than 1 LSB of RGB byte
			if (mAlpha <= threshold)
			{
				// don't bother if it won't show up
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mX, mY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:22,代码来源:DrawableHolder.cs

示例7: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowLeft != null)
			{
				int scrollX = mScrollX;
				if (!mEdgeGlowLeft.isFinished())
				{
					int restoreCount = canvas.save();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(270);
					canvas.translate(-height + mPaddingTop, System.Math.Min(0, scrollX));
					mEdgeGlowLeft.setSize(height, getWidth());
					if (mEdgeGlowLeft.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowRight.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(90);
					canvas.translate(-mPaddingTop, -(System.Math.Max(getScrollRange(), scrollX) + width
						));
					mEdgeGlowRight.setSize(height, width);
					if (mEdgeGlowRight.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:36,代码来源:HorizontalScrollView.cs

示例8: draw

		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowTop != null)
			{
				int scrollY = mScrollY;
				if (!mEdgeGlowTop.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					canvas.translate(mPaddingLeft, System.Math.Min(0, scrollY));
					mEdgeGlowTop.setSize(width, getHeight());
					if (mEdgeGlowTop.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowBottom.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					int height = getHeight();
					canvas.translate(-width + mPaddingLeft, System.Math.Max(getScrollRange(), scrollY
						) + height);
					canvas.rotate(180, width, 0);
					mEdgeGlowBottom.setSize(width, height);
					if (mEdgeGlowBottom.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:35,代码来源:ScrollView.cs

示例9: draw

		public virtual void draw(android.graphics.Canvas canvas)
		{
			if (mState == STATE_NONE)
			{
				// No need to draw anything
				return;
			}
			int y = mThumbY;
			int viewWidth = mList.getWidth();
			android.widget.FastScroller.ScrollFade scrollFade = mScrollFade;
			int alpha = -1;
			if (mState == STATE_EXIT)
			{
				alpha = scrollFade.getAlpha();
				if (alpha < android.widget.FastScroller.ScrollFade.ALPHA_MAX / 2)
				{
					mThumbDrawable.setAlpha(alpha * 2);
				}
				int left = 0;
				switch (mPosition)
				{
					case android.view.View.SCROLLBAR_POSITION_DEFAULT:
					case android.view.View.SCROLLBAR_POSITION_RIGHT:
					{
						left = viewWidth - (mThumbW * alpha) / android.widget.FastScroller.ScrollFade.ALPHA_MAX;
						break;
					}

					case android.view.View.SCROLLBAR_POSITION_LEFT:
					{
						left = -mThumbW + (mThumbW * alpha) / android.widget.FastScroller.ScrollFade.ALPHA_MAX;
						break;
					}
				}
				mThumbDrawable.setBounds(left, 0, left + mThumbW, mThumbH);
				mChangedBounds = true;
			}
			if (mTrackDrawable != null)
			{
				android.graphics.Rect thumbBounds = mThumbDrawable.getBounds();
				int left = thumbBounds.left;
				int halfThumbHeight = (thumbBounds.bottom - thumbBounds.top) / 2;
				int trackWidth = mTrackDrawable.getIntrinsicWidth();
				int trackLeft = (left + mThumbW / 2) - trackWidth / 2;
				mTrackDrawable.setBounds(trackLeft, halfThumbHeight, trackLeft + trackWidth, mList
					.getHeight() - halfThumbHeight);
				mTrackDrawable.draw(canvas);
			}
			canvas.translate(0, y);
			mThumbDrawable.draw(canvas);
			canvas.translate(0, -y);
			// If user is dragging the scroll bar, draw the alphabet overlay
			if (mState == STATE_DRAGGING && mDrawOverlay)
			{
				if (mOverlayPosition == OVERLAY_AT_THUMB)
				{
					int left = 0;
					switch (mPosition)
					{
						case android.view.View.SCROLLBAR_POSITION_DEFAULT:
						case android.view.View.SCROLLBAR_POSITION_RIGHT:
						default:
						{
							left = System.Math.Max(0, mThumbDrawable.getBounds().left - mThumbW - mOverlaySize
								);
							break;
						}

						case android.view.View.SCROLLBAR_POSITION_LEFT:
						{
							left = System.Math.Min(mThumbDrawable.getBounds().right + mThumbW, mList.getWidth
								() - mOverlaySize);
							break;
						}
					}
					int top = System.Math.Max(0, System.Math.Min(y + (mThumbH - mOverlaySize) / 2, mList
						.getHeight() - mOverlaySize));
					android.graphics.RectF pos = mOverlayPos;
					pos.left = left;
					pos.right = pos.left + mOverlaySize;
					pos.top = top;
					pos.bottom = pos.top + mOverlaySize;
					if (mOverlayDrawable != null)
					{
						mOverlayDrawable.setBounds((int)pos.left, (int)pos.top, (int)pos.right, (int)pos.
							bottom);
					}
				}
				mOverlayDrawable.draw(canvas);
				android.graphics.Paint paint = mPaint;
				float descent = paint.descent();
				android.graphics.RectF rectF = mOverlayPos;
				android.graphics.Rect tmpRect = mTmpRect;
				mOverlayDrawable.getPadding(tmpRect);
				int hOff = (tmpRect.right - tmpRect.left) / 2;
				int vOff = (tmpRect.bottom - tmpRect.top) / 2;
				canvas.drawText(mSectionText, (int)(rectF.left + rectF.right) / 2 - hOff, (int)(rectF
					.bottom + rectF.top) / 2 + mOverlaySize / 4 - descent - vOff, paint);
			}
			else
//.........这里部分代码省略.........
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:FastScroller.cs

示例10: onDraw

		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			base.onDraw(canvas);
			if (mDrawable == null)
			{
				return;
			}
			// couldn't resolve the URI
			if (mDrawableWidth == 0 || mDrawableHeight == 0)
			{
				return;
			}
			// nothing to draw (empty bounds)
			if (mDrawMatrix == null && mPaddingTop == 0 && mPaddingLeft == 0)
			{
				mDrawable.draw(canvas);
			}
			else
			{
				int saveCount = canvas.getSaveCount();
				canvas.save();
				if (mCropToPadding)
				{
					int scrollX = mScrollX;
					int scrollY = mScrollY;
					canvas.clipRect(scrollX + mPaddingLeft, scrollY + mPaddingTop, scrollX + mRight -
						 mLeft - mPaddingRight, scrollY + mBottom - mTop - mPaddingBottom);
				}
				canvas.translate(mPaddingLeft, mPaddingTop);
				if (mDrawMatrix != null)
				{
					canvas.concat(mDrawMatrix);
				}
				mDrawable.draw(canvas);
				canvas.restoreToCount(saveCount);
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:37,代码来源:ImageView.cs


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