本文整理汇总了C#中RelativeLayout.SetMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.SetMinimumWidth方法的具体用法?C# RelativeLayout.SetMinimumWidth怎么用?C# RelativeLayout.SetMinimumWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.SetMinimumWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow header = new TableRow (Activity);
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 p = new TableRow.LayoutParams ();
p.Height = TableLayout.LayoutParams.WrapContent;
p.Width = TableLayout.LayoutParams.WrapContent;
p.Gravity = GravityFlags.Center;
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 = p;
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 = p;
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 = p;
rr.AddView (vv);
foreach (var attendace in currentAttendances) {
RelativeLayout rl = new RelativeLayout(Activity);
rl.SetGravity (GravityFlags.Center);
rl.SetMinimumHeight (68);
rl.SetMinimumWidth (68);
rl.LayoutParameters = p;
rl.Id = attendace.id;
string value = string.Empty;
if (attendace.id != -1) {
value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
} else {
value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
rl.Click += Rl_Click;
}
TextView vvv = new TextView (Activity);
vvv.Gravity = GravityFlags.Center;
if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
// rl.SetBa
rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
// rl.SetBackgroundResource(Resource.Style.alert_success);
} else {
vvv.SetTextAppearance (Activity, Resource.Style.text_success);
//.........这里部分代码省略.........
示例3: RefreshTable
void RefreshTable()
{
table.RemoveAllViews ();
TableRow header = new TableRow (Activity);
header.SetMinimumHeight (70);
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 p = new TableRow.LayoutParams ();
p.Height = TableLayout.LayoutParams.WrapContent;
p.Width = TableLayout.LayoutParams.WrapContent;
p.Gravity = GravityFlags.Center;
TableLayout tlHeader = new TableLayout (Activity);
TableRow rAttendance = new TableRow (Activity);
foreach (var attendace in drugInfo.attendaces) {
TextView hAttendace = new TextView (Activity);
hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
hAttendace.LayoutParameters = p;
hAttendace.Rotation = -60;
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 = p;
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 = p;
rr.AddView (vv);
foreach (var attendace in drugInfo.attendaces) {
RelativeLayout rl = new RelativeLayout(Activity);
rl.SetGravity (GravityFlags.Center);
rl.SetMinimumHeight (68);
rl.SetMinimumWidth (68);
rl.LayoutParameters = p;
rl.Id = attendace.id;
rl.Click += (object sender, EventArgs e) => {
RelativeLayout rlAttendace = (RelativeLayout) sender;
TableRow trDrug = (TableRow) rl.Parent;
TableLayout trInfo = (TableLayout) rl.Parent.Parent;
string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);
Toast.MakeText(Activity, message, ToastLength.Short).Show();
FragmentTransaction trans = FragmentManager.BeginTransaction ();
DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
Bundle args = new Bundle();
args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
// args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));
drugInfoValueDialog.Arguments = args;
//.........这里部分代码省略.........