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


C# TableRow.SetBackgroundColor方法代码示例

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


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

示例1: UpdateMemoryTableUI

        private void UpdateMemoryTableUI()
        {
            tlData.RemoveAllViews();
            foreach (var memoryItem in store.Items)
            {
                TableRow tr = new TableRow(this);
                var rowColor = Color.White;
                tr.SetBackgroundColor(rowColor);

                var cellColor = Color.Black;
                var txtVal1 = new TextView(this) {Text = memoryItem.Values[0]};
                txtVal1.SetPadding(1, 1, 1, 1);
                tr.AddView(txtVal1);
                txtVal1.SetBackgroundColor(cellColor);
                var txtVal2 = new TextView(this) {Text = memoryItem.Values[1]};
                txtVal2.SetPadding(1, 1, 1, 1);
                txtVal2.SetBackgroundColor(cellColor);
                tr.AddView(txtVal2);
                tlData.AddView(tr);
            }
        }
开发者ID:nastyaK,项目名称:MemorizeIt,代码行数:21,代码来源:MainActivity.cs

示例2: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here

            SetContentView(Resource.Layout.TestTable);

            mainTable = FindViewById <TableLayout> (Resource.Id.maintable);

            for (int i=0; i<10 ; i++){

                // Create a TableRow and give it an ID
                TableRow tr = new TableRow(this);
                tr.Id = 100+i;
                tr.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent);

                // Create a TextView for column 1
                TextView col1 = new TextView(this);
                col1.Id = 200+i;
                col1.Text = ("col1");
                col1.SetPadding(0,0,2,0);
                col1.SetTextColor(Android.Graphics.Color.Black);
                col1.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent);
                tr.AddView(col1);

                // Create a TextView for column 2
                TextView col2 = new TextView(this);
                col2.Id = 300 + i;
                col2.Text = "col2";
                col2.SetPadding(0,0,2,0);
                col2.SetTextColor(Android.Graphics.Color.Black);
                col2.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent);
                tr.AddView(col2);

                // Create a TextView for column 3
                TextView col3 = new TextView(this);
                col3.Id = 500+i;
                col3.Text = DateTime.Now.ToString("dd.MM");
                col3.SetTextColor(Android.Graphics.Color.Black);
                if (i%2 == 0)
                {
                    col1.SetBackgroundColor(Android.Graphics.Color.White);
                    col2.SetBackgroundColor(Android.Graphics.Color.White);
                    col3.SetBackgroundColor(Android.Graphics.Color.White);
                    tr.SetBackgroundColor(Android.Graphics.Color.White);
                }
                else
                {
                    tr.SetBackgroundColor(Android.Graphics.Color.LightGray);
                    col1.SetBackgroundColor(Android.Graphics.Color.LightGray);
                    col2.SetBackgroundColor(Android.Graphics.Color.LightGray);
                    col3.SetBackgroundColor(Android.Graphics.Color.LightGray);
                }
                col3.SetHorizontallyScrolling(false);
                col3.SetMaxLines(100);
                col3.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent, 1f);
                tr.AddView(col3);

                // Add the TableRow to the TableLayout
                mainTable.AddView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent));
                //i++;
            }
        }
开发者ID:pafik13,项目名称:PresenterPlanner,代码行数:64,代码来源:TestTable.cs

示例3: AttachmentView

			public AttachmentView (Context context, string title, long size)
				: base (context)
			{
				var row = new TableRow (context) {
				};
				row.SetBackgroundColor (AttachmentColor);
				AddView (row);

				var tlabel = new TextView (context) {
					Text = title,
					LayoutParameters = new TableRow.LayoutParams (TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent) {
						LeftMargin = 4,
					},
				};
				tlabel.SetTextColor (Color.Black);
				tlabel.SetTextSize (ComplexUnitType.Sp, LabelTextSize);
				row.AddView (tlabel);

				if (size > 0) {
					var slabel = new TextView (context) {
						Text = FormatSize (size),
						LayoutParameters = new TableRow.LayoutParams (TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent) {
							LeftMargin = 4,
							RightMargin = 4,
						},
					};
					slabel.SetTextColor (Color.Black);
					slabel.SetTextSize (ComplexUnitType.Sp, LabelTextSize);
					row.AddView (slabel);
				}

				SetColumnStretchable (0, true);
				LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) {
					TopMargin = 2,
				};
			}
开发者ID:johnbeans,项目名称:Xamarin.Social,代码行数:36,代码来源:ShareActivity.cs


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