本文整理汇总了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);
}
}
示例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++;
}
}
示例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,
};
}