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


C# Android.DrawLine方法代码示例

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


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

示例1: OnDraw

		protected override void OnDraw (Android.Graphics.Canvas canvas)
		{
			base.OnDraw (canvas);
			Paint pnt=new Paint();
			pnt.Color = separatorColor;
			pnt.StrokeWidth = 5;

			canvas.DrawLine(0,0,this.ScreenWidth,0,pnt);

		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:10,代码来源:SeparatorView.cs

示例2: OnDraw

		protected override void OnDraw (Android.Graphics.Canvas canvas)
		{
			int height = Height;
			int childCount = ChildCount;
			int dividerHeightPx = (int) (Math.Min(Math.Max(0f, _dividerHeight), 1f) * height);
			SlidingTabLayout.ITabColorizer tabColorizer =_customTabColorizer != null ? _customTabColorizer: _defaultTabColorizer;

			// Thick colored underline below the current selection
			if (childCount > 0) {
				View selectedTitle = GetChildAt(_selectedPosition);
				int left = selectedTitle.Left;
				int right = selectedTitle.Right;
				int color = tabColorizer.GetIndicatorColor(_selectedPosition);

				if (_selectionOffset > 0f && _selectedPosition < (ChildCount - 1)) {
					int nextColor = tabColorizer.GetIndicatorColor(_selectedPosition + 1);
					if (color != nextColor) {
						color = BlendColors(nextColor, color, _selectionOffset);
					}

					// Draw the selection partway between the tabs
					View nextTitle = GetChildAt(_selectedPosition + 1);
					left = (int) (_selectionOffset * nextTitle.Left +(1.0f - _selectionOffset) * left);
					right = (int) (_selectionOffset * nextTitle.Right +(1.0f - _selectionOffset) * right);
				}
					
				_selectedIndicatorPaint.Color = Color.LightSkyBlue;


				canvas.DrawRect(left, height - _selectedIndicatorThickness, right,
					height, _selectedIndicatorPaint);
			}

			// Thin underline along the entire bottom edge
			canvas.DrawRect(0, height - _bottomBorderThickness, Width, height, _bottomBorderPaint);

			// Vertical separators between the titles
			int separatorTop = (height - dividerHeightPx) / 2;
			for (int i = 0; i < childCount - 1; i++) {
				View child = GetChildAt(i);
				_dividerPaint.Color=Color.Gray;
				canvas.DrawLine(child.Right, separatorTop, child.Right,
					separatorTop + dividerHeightPx, _dividerPaint);
			}
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:45,代码来源:SlidingTabStrip.cs


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