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


C# TextView.SetMaxHeight方法代码示例

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


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

示例1: Initialize

		private void Initialize()
		{
			ImageView logo = new ImageView(Context) { Id = 0x0fffff2a };
			logo.SetImageResource(Resource.Drawable.logo);
			logo.SetAdjustViewBounds(true);
			logo.SetMinimumHeight(60);
			logo.SetMaxHeight(60);

			_imageCategoryView = new ImageView(Context);
			_imageCategoryView.SetAdjustViewBounds(true);
			_imageCategoryView.SetMinimumHeight(60);
			_imageCategoryView.SetMaxHeight(60);
			_imageCategoryView.Id = 0x0fffff2b;
			_imageCategoryView.SetMinimumWidth(60);
			_imageCategoryView.SetMaxWidth(60);
			_imageCategoryView.Measure(60, 60);

			_textCategoryView = new TextView(Context);
			_textCategoryView.SetMaxHeight(60);
			_textCategoryView.SetTextColor(Color.Black);
			_textCategoryView.Id = 0x0fffff2c;
			_textCategoryView.SetTextSize(ComplexUnitType.Sp, 15);
			_textCategoryView.Gravity = GravityFlags.CenterVertical;

			LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.AlignParentRight);
			lp.AddRule(LayoutRules.CenterVertical);
			AddView(logo, lp);

			lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.CenterVertical);
			AddView(_imageCategoryView, lp);

			lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.RightOf, _imageCategoryView.Id);
			lp.AddRule(LayoutRules.CenterVertical);
			lp.SetMargins(60, 0, 60, 0);
			AddView(_textCategoryView, lp);
		}
开发者ID:india-rose,项目名称:xamarin-indiarose,代码行数:40,代码来源:TitleBarView.cs

示例2: ini

		public void ini(){


			var textFormat = Android.Util.ComplexUnitType.Px;

			var textFormatdip = Android.Util.ComplexUnitType.Dip;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			mainLinearLayout = new LinearLayout (context);
			headerLinearLayout = new LinearLayout (context);
			contentLinearLayout = new LinearLayout (context);
			mainHeaderLinearLayout = new LinearLayout (context);


			imHeader = new ImageView (context);
			titleHeader = new TextView (context);
			AutorHeader = new TextView (context);
			content = new TextView (context);

			titleHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			AutorHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			content.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");


			mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125));
			contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);

			mainLinearLayout.Orientation = Orientation.Vertical;
			mainHeaderLinearLayout.Orientation = Orientation.Horizontal;
			headerLinearLayout.Orientation = Orientation.Vertical;
			contentLinearLayout.Orientation = Orientation.Vertical;


			mainLinearLayout.AddView (mainHeaderLinearLayout);
			mainLinearLayout.AddView (contentLinearLayout);

			mainHeaderLinearLayout.AddView (imHeader);
			mainHeaderLinearLayout.AddView (headerLinearLayout);


			headerLinearLayout.AddView (titleHeader);
			headerLinearLayout.AddView (AutorHeader);
			headerLinearLayout.SetPadding (15, 0, 0, 10);
			AutorHeader.SetPadding (0, 15, 0, 0);

			contentLinearLayout.AddView (content);
			contentLinearLayout.SetPadding (0, 15, 0, 0);


			mainLinearLayout.SetBackgroundResource (Resource.Drawable.border);
			//			mainLinearLayout.SetX (Configuration.getHeight (45));
			//mainLinearLayout.SetY (Configuration.getWidth (500));



			//titleHeader.Text = "Diferentes tipos de aves en Perú";
			titleHeader.SetTextColor (Color.ParseColor ("#FF0080"));
			//titleHeader.SetTextSize (textFormat, Configuration.getHeight (38));
			titleHeader.SetTextSize (textFormatdip, 16.0f);

			titleHeader.SetMaxWidth (Configuration.getWidth (274));
			titleHeader.SetMaxHeight (Configuration.getHeight (80));
			//titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion));
			titleHeader.Ellipsize = TextUtils.TruncateAt.End;
			titleHeader.SetMaxLines(2);


			//AutorHeader.Text = "Autor del Articulo";
			AutorHeader.SetTextColor(Color.ParseColor ("#424242"));
			AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23));
			AutorHeader.SetMaxWidth (Configuration.getWidth (274));
			//AutorHeader.SetMaxHeight (Configuration.getHeight (25));
			//AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion));
			AutorHeader.Ellipsize = TextUtils.TruncateAt.End;
			AutorHeader.SetMaxLines(1);

			//content.Text = "Los factores geográficos, climáticos y evolutivos  convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de";
			//content.SetTextSize (textFormat, Configuration.getHeight (24));
			content.SetTextSize (textFormatdip, 12.0f);
			content.SetMaxWidth (Configuration.getWidth(501));
			//content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion));
			//content.Ellipsize = TextUtils.TruncateAt.End;
			//content.SetMaxLines(4);

			//imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true));
			//imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion));
			imHeader.SetMaxWidth (Configuration.getWidth (124));
			imHeader.SetMaxHeight (Configuration.getWidth (124));




			int padW = Configuration.getWidth(45);
			int padH = Configuration.getHeight (15);

			mainLayout.SetPadding (padW,padH,padW,padH);
//.........这里部分代码省略.........
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:101,代码来源:Template1.cs


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