本文整理汇总了C#中RelativeLayout.SetTag方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.SetTag方法的具体用法?C# RelativeLayout.SetTag怎么用?C# RelativeLayout.SetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.SetTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow header = new TableRow (Activity);
// header.
header.SetMinimumHeight (88);
TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
hParamsDrug.Gravity = GravityFlags.Center;
// hParamsDrug.Span = 2;
TextView hDrug = new TextView (Activity);
hDrug.Text = @"Препараты";
hDrug.LayoutParameters = hParamsDrug;
header.AddView(hDrug);
TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
lpRow.Height = TableLayout.LayoutParams.WrapContent;
lpRow.Width = TableLayout.LayoutParams.WrapContent;
lpRow.Gravity = GravityFlags.Center;
// TableLayout.LayoutParams pp = new TableLayout.LayoutParams ();
// pp.
// TableLayout tlHeader = new TableLayout (Activity);
// TableRow rAttendance = new TableRow (Activity);
foreach (var attendace in currentAttendances) {
TextView hAttendace = new TextView (Activity);
hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
hAttendace.LayoutParameters = lpRow;
hAttendace.Rotation = -70;
header.AddView (hAttendace);
// rAttendance.AddView(hAttendace);
}
// tlHeader.AddView (rAttendance);
// header.AddView (tlHeader);
// table.AddView(header);
foreach (var info in infos) {
TableRow r = new TableRow (Activity);
TextView v = new TextView (Activity);
v.Gravity = GravityFlags.Center;
v.SetSingleLine (false);
v.SetMinimumHeight (72);
v.SetMinimumWidth (68);
v.Rotation = -90;
// v.SetBackgroundResource (Resource.Style.text_row);
// v.SetB
// v.Text = info.infoID.ToString();
// v.Text = GetInfo(info.infoID).name;
// v.SetHorizontallyScrolling (false);
v.Text = info.name;
v.LayoutParameters = lpRow;
r.AddView (v);
TableLayout tl = new TableLayout (Activity);
if (header.Parent == null) {
tl.AddView (header);
}
tl.Id = info.id;
foreach (var drug in drugs) {
TableRow rr = new TableRow (Activity);
rr.Id = drug.id;
TextView vv = new TextView (Activity);
vv.Gravity = GravityFlags.Center;
vv.SetMinimumHeight (42);
vv.SetMinimumWidth (76);
// vv.Text = drugInfo.drugID.ToString();
// vv.Text = GetDrug(drugInfo.drugID).fullName;
vv.Text = drug.fullName;
vv.LayoutParameters = lpRow;
vv.SetBackgroundColor (Android.Graphics.Color.White);
rr.AddView (vv);
foreach (var attendace in currentAttendances) {
TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
lpValue.Height = TableLayout.LayoutParams.WrapContent;
lpValue.Width = TableLayout.LayoutParams.WrapContent;
lpValue.Gravity = GravityFlags.Center;
lpValue.SetMargins (1, 1, 1, 1);
RelativeLayout rl = new RelativeLayout(Activity);
rl.SetGravity (GravityFlags.Center);
rl.SetMinimumHeight (68);
rl.SetMinimumWidth (68);
rl.LayoutParameters = lpValue;
rl.Id = attendace.id;
rl.SetTag (Resource.String.IDinfo, info.id);
rl.SetTag (Resource.String.IDdrug, drug.id);
rl.SetTag (Resource.String.IDattendance, attendace.id);
string value = string.Empty;
if (attendace.id != -1) {
//.........这里部分代码省略.........
示例2: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
lpRow.Height = TableLayout.LayoutParams.WrapContent;
lpRow.Width = TableLayout.LayoutParams.WrapContent;
lpRow.Gravity = GravityFlags.Center;
//header
TableRow trHeader = new TableRow (Activity);
TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
//tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
tvHDrug.Text = "Препараты";
tvHDrug.LayoutParameters = lpRow;
((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
trHeader.AddView (tvHDrug);
int i = 0;
TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
lpValue.Height = TableLayout.LayoutParams.WrapContent;
lpValue.Width = TableLayout.LayoutParams.WrapContent;
lpValue.Gravity = GravityFlags.Center;
lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
foreach (var drug in drugs) {
i++;
TableRow trRow = new TableRow (Activity);
TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
tvDrug.Gravity = GravityFlags.CenterVertical;
tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
tvDrug.LayoutParameters = lpRow;
tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
trRow.AddView (tvDrug);
foreach (var info in infos) {
if (trHeader.Parent == null) {
TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
tvHInfo.Text = info.name;
tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
trHeader.AddView (tvHInfo);
}
RelativeLayout rlValue = new RelativeLayout(Activity);
rlValue.SetGravity (GravityFlags.Center);
rlValue.SetMinimumHeight (ToDIP(64));
rlValue.SetMinimumWidth (ToDIP(64));
rlValue.LayoutParameters = lpValue;
rlValue.SetTag (Resource.String.IDinfo, info.id);
rlValue.SetTag (Resource.String.IDdrug, drug.id);
// rlValue.SetTag (Resource.String.IDattendance, attendace.id);
string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
if (info.valueType == @"number") {
RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
nlpValue.AddRule (LayoutRules.CenterInParent);
nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
evValue.SetMinimumWidth (ToDIP(64));
evValue.SetMaxWidth (ToDIP(64));
evValue.InputType = Android.Text.InputTypes.ClassNumber;
evValue.Text = value.Equals (@"N") ? string.Empty : value;
rlValue.AddView (evValue);
evValue.AfterTextChanged += NumberValue_AfterTextChanged;
}
if (info.valueType == @"decimal") {
RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
dlpValue.AddRule (LayoutRules.CenterInParent);
dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));
EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
evValue.SetMinimumWidth (ToDIP(64));
evValue.SetMaxWidth (ToDIP(64));
evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
evValue.Text = value.Equals (@"N") ? string.Empty : value;
rlValue.AddView (evValue);
evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
}
if (info.valueType == @"boolean") {
rlValue.Click += Rl_Click;
TextView tvValue = new TextView (Activity);
tvValue.Gravity = GravityFlags.Center;
if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
} else {
tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
//.........这里部分代码省略.........