protected override void onDraw(android.graphics.Canvas canvas)
            {

                var paint = new android.graphics.Paint();

                paint.setStyle(android.graphics.Paint.Style.STROKE);
                //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                paint.setColor(android.graphics.Color.RED);
                paint.setTextSize(textSize);

                var text = this.text();

                canvas.drawText(text, x, y, paint);
                canvas.drawText(text, x + 2560 / 2, y, paint);

                base.onDraw(canvas);
            }
            protected override void onDraw(android.graphics.Canvas canvas)
            {
                {
                    var paint = new android.graphics.Paint();

                    paint.setStyle(android.graphics.Paint.Style.STROKE);
                    //paint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
                    //paint.setColor(android.graphics.Color.RED);
                    //paint.setColor(android.graphics.Color.YELLOW);
                    paint.setColor(color);
                    paint.setTextSize(textSize);
                    paint.setAlpha(alpha);

                    var a = this.text().Split('\n');

                    a.WithEachIndex(
                        (text, i) =>
                        {

                            canvas.drawText(text, x, y + i * 24, paint);
                            canvas.drawText(text, x + 2560 / 2, y + i * 24, paint);
                        }
                    );
                }

                if (AtDraw != null)
                    AtDraw(canvas);


                base.onDraw(canvas);
            }
예제 #3
0
		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			if (mSelectorWheelState == SELECTOR_WHEEL_STATE_NONE)
			{
				return;
			}
			float x = (mRight - mLeft) / 2;
			float y = mCurrentScrollOffset;
			int restoreCount = canvas.save();
			if (mSelectorWheelState == SELECTOR_WHEEL_STATE_SMALL)
			{
				android.graphics.Rect clipBounds = canvas.getClipBounds();
				clipBounds.inset(0, mSelectorElementHeight);
				canvas.clipRect(clipBounds);
			}
			// draw the selector wheel
			int[] selectorIndices = mSelectorIndices;
			{
				for (int i = 0; i < selectorIndices.Length; i++)
				{
					int selectorIndex = selectorIndices[i];
					string scrollSelectorValue = mSelectorIndexToStringCache.get(selectorIndex);
					// Do not draw the middle item if input is visible since the input is shown only
					// if the wheel is static and it covers the middle item. Otherwise, if the user
					// starts editing the text via the IME he may see a dimmed version of the old
					// value intermixed with the new one.
					if (i != SELECTOR_MIDDLE_ITEM_INDEX || mInputText.getVisibility() != VISIBLE)
					{
						canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
					}
					y += mSelectorElementHeight;
				}
			}
			// draw the selection dividers (only if scrolling and drawable specified)
			if (mSelectionDivider != null)
			{
				// draw the top divider
				int topOfTopDivider = (getHeight() - mSelectorElementHeight - mSelectionDividerHeight
					) / 2;
				int bottomOfTopDivider = topOfTopDivider + mSelectionDividerHeight;
				mSelectionDivider.setBounds(0, topOfTopDivider, mRight, bottomOfTopDivider);
				mSelectionDivider.draw(canvas);
				// draw the bottom divider
				int topOfBottomDivider = topOfTopDivider + mSelectorElementHeight;
				int bottomOfBottomDivider = bottomOfTopDivider + mSelectorElementHeight;
				mSelectionDivider.setBounds(0, topOfBottomDivider, mRight, bottomOfBottomDivider);
				mSelectionDivider.draw(canvas);
			}
			canvas.restoreToCount(restoreCount);
		}
예제 #4
0
		public virtual void drawText(android.graphics.Canvas c, int start, int end, float
			 x, float y, android.graphics.Paint p)
		{
			checkRange("drawText", start, end);
			if (end <= mGapStart)
			{
				c.drawText(mText, start, end - start, x, y, p);
			}
			else
			{
				if (start >= mGapStart)
				{
					c.drawText(mText, start + mGapLength, end - start, x, y, p);
				}
				else
				{
					char[] buf = android.text.TextUtils.obtain(end - start);
					getChars(start, end, buf, 0);
					c.drawText(buf, 0, end - start, x, y, p);
					android.text.TextUtils.recycle(buf);
				}
			}
		}
예제 #5
0
		public override void draw(android.graphics.Canvas c, android.graphics.Path highlight
			, android.graphics.Paint highlightpaint, int cursorOffset)
		{
			if (mDirect != null && highlight == null)
			{
				c.drawText(mDirect, 0, mBottom - mDesc, mPaint);
			}
			else
			{
				base.draw(c, highlight, highlightpaint, cursorOffset);
			}
		}
예제 #6
0
		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
			{
				if (mState == STATE_EXIT)
				{
					if (alpha == 0)
					{
						// Done with exit
						setState(STATE_NONE);
					}
					else
					{
						if (mTrackDrawable != null)
						{
							mList.invalidate(viewWidth - mThumbW, 0, viewWidth, mList.getHeight());
						}
						else
						{
							mList.invalidate(viewWidth - mThumbW, y, viewWidth, y + mThumbH);
						}
					}
				}
			}
		}