private void drawItems(List <XElement> items, TableLayout tableLayout, TableRow tableRow) { foreach (var it in items) { var codeData = new List <string>() { it.Attribute("series").Value, it.Attribute("order").Value, it.Attribute("type").Value //it.Attribute("brend").Value }; for (int i = 0; i < codeData.Count; i++) { var txt = "<b>"; if (i == 0) { txt += "Серия:"; } else if (i == 1) { txt += "Заказной код:"; } else if (i == 2) { txt += "Типовой код:"; } //else if (i == 3) // txt += "Бренд:"; txt += "</b> "; txtView = new TextView(this); txtView.SetText(Html.FromHtml(txt + codeData[i]), TextView.BufferType.Editable); txtView.SetBackgroundResource(Resource.Layout.finded); txtView.Gravity = GravityFlags.Left; txtView.SetPadding(25, 25, 25, 25); txtView.SetTextColor(Color.Black); //txtView.SetTypeface(Typeface.Default, TypefaceStyle.Bold); tableRow = new TableRow(this); tableRow.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent); tableRow.AddView(txtView); tableLayout.AddView(tableRow); } txtView = new TextView(this); txtView.SetText(Html.FromHtml(""), TextView.BufferType.Editable); txtView.Gravity = GravityFlags.Left; txtView.SetPadding(25, 25, 25, 25); txtView.SetTextColor(Color.Black); //txtView.SetTypeface(Typeface.Default, TypefaceStyle.Normal); tableRow = new TableRow(this); tableRow.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent); tableRow.AddView(txtView); tableLayout.AddView(tableRow); } }
void AddMembresiaDescripcion() { membresias.AsParallel().ToList().ForEach(precio => { TableRow trDescripcion = new TableRow(this); TextView lblCantidad = new TextView(this) { Text = precio.Carrito_Compras_Detalle_Cantidad }; lblCantidad.SetTextColor(Color.ParseColor("#767676")); trDescripcion.AddView(lblCantidad, 0); TextView lblDescripcion = new TextView(this) { Text = precio.Carrito_Compras_Detalle_Descripcion }; lblDescripcion.SetTextColor(Color.ParseColor("#767676")); lblDescripcion.SetWidth(120); lblDescripcion.Click += (sender, e) => ShowDesglose(precio); trDescripcion.AddView(lblDescripcion, 1); TextView lblTotal = new TextView(this) { Text = Convert.ToDecimal(precio.Carrito_Compras_Detalle_Importe_Suma) != 0 ? precio.Carrito_Compras_Detalle_Importe_Suma_Texto : Convert.ToDecimal(precio.Carrito_Compras_Detalle_Importe_Prorrateo).ToString("C", System.Globalization.CultureInfo.GetCultureInfo("es-mx")) + "MXN" }; lblTotal.SetTextColor(Color.ParseColor("#767676")); trDescripcion.AddView(lblTotal, 2); tlCarrito.AddView(trDescripcion); Subtotal += Convert.ToDecimal(precio.Carrito_Compras_Detalle_Importe_Suma) != 0 ? Convert.ToDecimal(precio.Carrito_Compras_Detalle_Importe_Suma) : Convert.ToDecimal(precio.Carrito_Compras_Detalle_Importe_Prorrateo); }); }
/// <summary> /// Create the table layout, and the image buttons, /// everything is assigned accordingly to the screen size. /// </summary> private void initializeTableLayout() { var metrics = Resources.DisplayMetrics; var widthInDp = metrics.WidthPixels; var heightInDp = metrics.HeightPixels; gameBoard = (TableLayout)FindViewById(Resource.Id.boardTable); TableRow.LayoutParams layoutParams = new TableRow.LayoutParams((widthInDp / 4), (widthInDp / 4)); TableRow tableRow1 = new TableRow(this); TableRow tableRow2 = new TableRow(this); TableRow tableRow3 = new TableRow(this); TableRow tableRow4 = new TableRow(this); bool flag = false; for (int i = 0; i < SIZE; i++) { flag = !flag; for (int j = 0; j < SIZE; j++) { gameImgButtons[i, j].SetImageResource(Resource.Drawable.blank); gameImgButtons[i, j].LayoutParameters = layoutParams; if (flag) { if ((j % 2) == 0) { gameImgButtons[i, j].SetBackgroundColor(Color.Black); } else { gameImgButtons[i, j].SetBackgroundColor(Color.Gray); } } else { if ((j % 2) != 0) { gameImgButtons[i, j].SetBackgroundColor(Color.Black); } else { gameImgButtons[i, j].SetBackgroundColor(Color.Gray); } } } tableRow1.AddView(gameImgButtons[0, i], i); tableRow2.AddView(gameImgButtons[1, i], i); tableRow3.AddView(gameImgButtons[2, i], i); tableRow4.AddView(gameImgButtons[3, i], i); } // Add rows to table gameBoard.AddView(tableRow1, 0); gameBoard.AddView(tableRow2, 1); gameBoard.AddView(tableRow3, 2); gameBoard.AddView(tableRow4, 3); }
public void addITR(TableLayout tl) { TableRow notes = new TableRow(this.Activity); notes.Tag = "notes"; note = new EditText(this.Activity); note.Hint = "Notes"; if (DataController.note != "") { note.Text = DataController.note; } note.Gravity = GravityFlags.Center; TableRow.LayoutParams stretchRow = new TableRow.LayoutParams(); stretchRow.Span = 6; notes.AddView(note, stretchRow); tl.AddView(notes); TableRow btnRow = new TableRow(this.Activity); btnRow.Tag = "btnRow"; Button requestITR = new Button(this.Activity); requestITR.Text = "ITR"; requestITR.Click += (object sender, EventArgs e) => { if (checkNetwork()) { Android.Support.V4.App.Fragment residentsFragment = null; residentsFragment = new ResidentsFragment(); ((ResidentsFragment)residentsFragment).SetResidentUpdate(residents); ((ResidentsFragment)residentsFragment).SetNotePrev(note.Text); Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction(); ft.Add(Resource.Id.content_frame, residentsFragment, "residentsFragment"); ft.Hide(FragmentManager.FindFragmentByTag("residentsPrevFragment")); ft.AddToBackStack(null); ft.Commit(); } else { showNetworkError(); } }; btnRow.AddView(requestITR, stretchRow); tl.AddView(btnRow); }
private void InitUI() { var root = new TableLayout(this); root.SetPadding(0, 20, 0, 0); //add buttons var buttonLayout = new LinearLayout(this); root.AddView(buttonLayout); selectFolderButton = new Button(this) { Text = "Select Folder", }; selectFolderButton.Click += BrowseOnClick; buttonLayout.AddView(selectFolderButton); readWriteButton = new Button(this) { Text = "Read & Write", }; readWriteButton.Click += ReadWriteClick; buttonLayout.AddView(readWriteButton); readZipButton = new Button(this) { Text = "Read Zip Contents", }; readZipButton.Click += ReadZipClick; buttonLayout.AddView(readZipButton); //add uri uriView = new TextView(this) { Text = "Uri: ", }; root.AddView(uriView); //add text infoView = new TextView(this) { TextSize = 20, Text = StorageUri == null ? "Info: First \"Select Folder\" then press \"Read & Write\" to check access." : "", }; root.AddView(infoView); SetContentView(root); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ScrollView scrollView = new ScrollView(this); TableLayout tableLayout = new TableLayout(this); TableRow tablerow = new TableRow(this); // make columns span the whole width tableLayout.SetColumnStretchable(0, true); tableLayout.SetColumnStretchable(1, true); TextView DepartCollumn = new TextView(this); DepartCollumn.Text = "Depart"; tablerow.AddView(DepartCollumn); TimetableList.TimeColumns.Add(DepartCollumn); TextView ArriveCollumn = new TextView(this); ArriveCollumn.Text = "Arrive"; tablerow.AddView(ArriveCollumn); TimetableList.TimeColumns.Add(ArriveCollumn); tableLayout.AddView(tablerow); // tableLayout.SetScrollContainer(true); scrollView.AddView(tableLayout); SetContentView(scrollView); }
/* MyFuncs */ void MakeTableHeader() { TableRow view = (TableRow)inflater.Inflate(Resource.Layout.TableRowHeader, null); view.FindViewById <TextView> (Resource.Id.txtFIO).Text = "ФИО"; listOfWeekNum = new List <int> (); int delta = 0; var min = ReportManager.GetMinWeekNum(); for (int i = 0; i < 12; i++) { if ((min + i) % 53 == 0) { delta = 1; } listOfWeekNum.Add((min + i + delta) % 53); } foreach (int weekNum in listOfWeekNum) { TextView txtWeekNum = (TextView)inflater.Inflate(Resource.Layout.TableWeekNum, null); txtWeekNum.Text = weekNum.ToString(); view.AddView(txtWeekNum); } tlHeader.AddView(view); }
private void BtnRGExamItem_Click(object sender, EventArgs e) { //人工评判 var text = ((Button)sender).Text; var result = GetDeductionRule(text); RGSelectExamItem = text; // View view = View.Inflate(this, Resource.Layout.Dialog_ArtificialEvaluation, null); TableLayout tableLayout = (TableLayout)alertDialog.FindViewById(Resource.Id.DeductionRuleTable); TableLayout tableLayoutExamItem = (TableLayout)alertDialog.FindViewById(Resource.Id.ExamItemBtnTable); //清空所有的 扣分规则 tableLayout.RemoveAllViews(); foreach (var item in result) { TableRow tableRow = (TableRow)LayoutInflater.From(this).Inflate(Resource.Layout.tableArtificialEvaluation, null); TextView tvDeductionReason = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionReason); TextView tvDeductionScore = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionScore); Button btnDeduction = (Button)tableRow.FindViewById(Resource.Id.btnDeduction); tvDeductionReason.Text = item.RuleName; tvDeductionScore.Text = item.DeductedScores.ToString(); btnDeduction.Text = "扣分"; btnDeduction.Tag = item.RuleCode + "," + item.SubRuleCode; btnDeduction.Click += BtnDeduction_Click; tableLayout.AddView(tableRow); } }
private void UpdateTableView() { // add the strings into the table layout TableLayout table = FindViewById <TableLayout>(Resource.Id.tableLayout); var layout = new TableRow.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); table.RemoveAllViews(); int i = 0; foreach (string s in directories) { TableRow row = new TableRow(this); TextView text = new TextView(this) { Text = s }; text.TextSize = 15; row.AddView(text); if (i++ % 2 == 0) { row.SetBackgroundColor(Android.Graphics.Color.LightBlue); } table.AddView(row); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Int32 currentIndex = _highlightCurrentSubject ? FindCurrentSubjectIndex(_subjects) : -1; View layout; if (_subjects == null) { layout = inflater.Inflate(Resource.Layout.message, container, false); TextView message = layout.FindViewById <TextView>(Resource.Id.messageTextView); message.SetText(Resource.String.weekendMessage); return(layout); } layout = inflater.Inflate(Resource.Layout.schedule, container, false); TableLayout table = layout.FindViewById <TableLayout>(Resource.Id.scheduleTableLayout); for (Int32 i = 0; i < _subjects.Length; i++) { if (!_subjects[i].IsDisplayed) { continue; } table.AddView(GetSubjectViewByIndex(inflater, table, i, currentIndex)); } return(layout); }
private void Generate_Table(List <TestHelper.Question> questions, bool show_wrong_inputs) { TableLayout table = FindViewById <TableLayout>(Resource.Id.tableAnswers); foreach (TestHelper.Question question in questions) { TextView text_value = new TextView(this); text_value.Text = question.value; TextView text_wrong_answers = new TextView(this); text_wrong_answers.Text = question.wrong_answers.ToString(); if (show_wrong_inputs) { text_wrong_answers.Text += string.Format(" ({0})", question.wrong_inputs); } text_wrong_answers.Gravity = GravityFlags.CenterHorizontal; if (question.wrong_answers > 0) { text_value.SetTextColor(Android.Graphics.Color.Red); text_wrong_answers.SetTextColor(Android.Graphics.Color.Red); } TableRow row = new TableRow(this); if (question.is_old) { row.SetBackgroundColor(Android.Graphics.Color.LightGray); } row.AddView(text_value); row.AddView(text_wrong_answers); table.AddView(row); } }
public static void InitDataDisplayView(Context context, TableLayout table, string fileName) { try { JSONObject jsonObject = new JSONObject(GetJson(context, fileName)); IIterator iterator = jsonObject.Keys(); while (iterator.HasNext) { string key = (string)iterator.Next(); string value = jsonObject.GetString(key); TableRow tableRow = new TableRow(context); TextView textView = new TextView(context); textView.Text = key; textView.SetTextColor(Color.Gray); textView.Id = context.Resources.GetIdentifier(key + "_key", "id", context.PackageName); tableRow.AddView(textView); EditText editText = new EditText(context); editText.Text = value; editText.Id = context.Resources .GetIdentifier(key + "_value", "id", context.PackageName); editText.SetTextColor(Color.DarkGray); tableRow.AddView(editText); table.AddView(tableRow); } } catch (JSONException e) { Log.Error("Utils.InitDataDisplayView", $"JSONException occured: {e.Message}"); } }
void FillHistorial() { TableLayout table = SalasView.FindViewById <TableLayout>(Resource.Id.historial_table); table.RemoveAllViews(); historico.AsParallel().ToList().ForEach(reservacion => { LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService); View ReservaView = inflater.Inflate(Resource.Layout.ReservacionElementoLayout, null, true); ReservaView.FindViewById <GridLayout>(Resource.Id.glReservacion).SetMinimumWidth(context.Resources.DisplayMetrics.WidthPixels); ReservaView.FindViewById <TextView>(Resource.Id.lblSalaJunta).Text = reservacion.Sala_Descripcion; ReservaView.FindViewById <TextView>(Resource.Id.lblDiaSemana).Text = DateTime.Parse(reservacion.Sala_Fecha).Day.ToString(); ReservaView.FindViewById <TextView>(Resource.Id.lblDia).Text = DateTime.Parse(reservacion.Sala_Fecha).DayOfWeek.ToString(); ReservaView.FindViewById <TextView>(Resource.Id.lblHorario).Text = reservacion.Sala_Hora_Inicio.Substring(0, 5) + " - " + reservacion.Sala_Hora_Fin.Substring(0, 5); ReservaView.FindViewById <ImageButton>(Resource.Id.btnCancelar).Click += delegate { if (controller.CancelarSalaJuntas("Baja", reservacion.Sala_Junta_Reservacion_Id)) { Toast.MakeText(context, Resource.String.str_meeting_room_canceled, ToastLength.Short).Show(); historico.Remove(reservacion); HistorialValidation(); } else { Toast.MakeText(context, Resource.String.ErrorIntento, ToastLength.Short).Show(); } }; TableRow row = new TableRow(context); row.AddView(ReservaView); table.AddView(row); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); account_id = Intent.GetStringExtra("account_id"); SetContentView(Resource.Layout.TotalsReport); Title = "Fund Totals - " + Db.getAccount(account_id).account_name; var scrollview = FindViewById<ScrollView>(Resource.Id.scrollview); var t = new TableLayout(this); t.StretchAllColumns = true; foreach (Fund f in Db.getFunds()) { var tr = new TableRow(this); var tdFundName = new TextView(this); tdFundName.Text = f.fund_name; tdFundName.Tag = f.fund_id; tdFundName.Click += Fund_Click; tr.AddView(tdFundName); var tdAmount = new TextView(this); tdAmount.Tag = f.fund_id; tdAmount.Click += Fund_Click; tdAmount.Text = String.Format("{0:C}", Db.getFundTotal(account_id: account_id, fund_id: f.fund_id)); tdAmount.Gravity = GravityFlags.Right; tr.AddView(tdAmount); t.AddView(tr); } scrollview.AddView(t); }
/// <summary> /// Create and populate UI block table based on engine data /// </summary> private void PopulateTable() { var height = _gameEngine.GetHeight(); var width = _gameEngine.GetWidth(); _blocks = new Block[width, height]; for (var row = 0; row < height; row++) { var mineRow = new TableRow(this); var mineRowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent, 0.0f); for (var col = 0; col < width; col++) { var block = new Block(this) { Row = row, Col = col, IsFlipped = false, IsFlagged = false }; _blocks[col, row] = block; mineRow.AddView(_blocks[col, row]); } _mineTable.AddView(mineRow, mineRowParams); } }
private void ShowGeneratedRoutes() //drawing UI elements needs to be fixed { TableLayout layout = FindViewById <TableLayout>(Resource.Id.routeList); foreach (var route in _generatedRoutes) { var text = new TextView(this); text.Text = route.ToString(); text.SetTextColor(new Color(252, 177, 80)); //our orange text.SetTextSize(Android.Util.ComplexUnitType.Pt, 7); //text.SetWidth(); //text.SetHeight(); TableRow.LayoutParams par = new TableRow.LayoutParams(); par.SetMargins(100, 0, 0, 0); var button = new Button(this); button.Text = "Pirkti"; button.Background = Resources.GetDrawable(Resource.Drawable.OrangeActionBtn); //deprecated but f**k it button.SetTextColor(Color.White); button.Click += (obj, evnt) => { Order(route); }; var tableRow = new TableRow(this); tableRow.SetMinimumHeight(250); tableRow.AddView(text); tableRow.AddView(button, par); layout.AddView(tableRow); } }
public void addRole(ref int count) { cb = new CheckBox(this); tv_view1 = new TextView(this); if (count < 10) { tv_view1.Text = "0" + count; } else { tv_view1.Text = "" + count; } count++; tv_view2 = new TextView(this); tv_view2.Text = "test"; tv_view3 = new TextView(this); tv_view3.Text = "test"; tv_view4 = new TextView(this); tv_view4.Text = "1"; tb = new TableRow(this); tb.AddView(cb); tb.AddView(tv_view1); tb.AddView(tv_view2); tb.AddView(tv_view3); tb.AddView(tv_view4); tl_view.AddView(tb); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here var container = new LinearLayout(this) { Background = Android.Graphics.Color.Yellow.ToDrawable(), }; SetContentView(container); var table = new TableLayout(this) { Background = Android.Graphics.Color.Red.ToDrawable(), StretchAllColumns = true, // カラムを均等割にする WeightSum = rows, // 行を均等割にしたいので行数を指定 }; container.AddView(table, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MatchParent, // 幅は親に合わせる LinearLayout.LayoutParams.MatchParent) // 高さは親に合わせる ); for (int i = 0; i < rows; i++) { var rowlayouts = new TableLayout.LayoutParams( TableLayout.LayoutParams.WrapContent, TableLayout.LayoutParams.WrapContent) { Weight = 1, // テーブルの中で均等割するので全ての重みを1にする Height = 0 // 高さを自動指定 }; var row = new TableRow(this); table.AddView(row, rowlayouts); for (int j = 0; j < cols; j++) { var buttonlayout = new TableRow.LayoutParams( TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent // 高さは行に合わせる ) { Width = 0, // 幅を自動設定 RightMargin = 4, // 隙間を開ける TopMargin = 4 // 隙間を開ける }; var button = new Button(this) { Text = $"{i}-{j}", Background = Android.Graphics.Color.Blue.ToButtonPressEffect() }; row.AddView(button, buttonlayout); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //set view SetContentView(Resource.Layout.SelectView); TextView Lab_RowTitle = FindViewById <TextView>(Resource.Id.Lab_RowTitle); Lab_RowTitle.Text = "時間"; //get Data // 得到跳转到该Activity的Intent对象 Bundle bundle = Intent.GetBundleExtra("bundle"); List <string> timelist = bundle.GetStringArrayList("timelist").ToList(); //Create your application here TableLayout MainTable = FindViewById <TableLayout>(Resource.Id.table_city); Button b; TableRow tr; for (int i = 0; i < timelist.Count; i++) { tr = new TableRow(this); b = new Button(this); string time = timelist[i].Substring(1, timelist[i].Length - 2); b.Text = time; b.Click += delegate { CreatNewSelect("4"); }; tr.AddView(b); MainTable.AddView(tr); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_results); Android.Support.V7.App.ActionBar actionBar = SupportActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); } TableLayout tl = FindViewById <TableLayout>(Resource.Id.tablelayout_contents); TableRow tr; TextView tv; List <string[]> data = ReadData(); foreach (string[] row in data) { tr = new TableRow(this); foreach (string cell in row) { tv = new TextView(this); tv.Background = ContextCompat.GetDrawable(this, Android.Resource.Drawable.EditBoxBackground); tv.Text = cell; tr.AddView(tv); } tl.AddView(tr); } string[] header = Resources.GetStringArray(Resource.Array.results_headers); tr = FindViewById <TableRow>(Resource.Id.tablerow_header); foreach (string cell in header) { tv = new TextView(this) { Background = ContextCompat.GetDrawable(this, Android.Resource.Drawable.EditBoxBackground), Text = cell }; tr.AddView(tv); } tl.ViewTreeObserver.GlobalLayout += (sender, args) => { TableRow trH; TextView tvH; trH = FindViewById <TableRow>(Resource.Id.tablerow_header); // if (tl.ChildCount > 0) for (int i = 0; i < tl.ChildCount; i++) { // tr = (TableRow)tl.GetChildAt(0); tr = (TableRow)tl.GetChildAt(i); for (int j = 0; j < tr.ChildCount; j++) { tv = (TextView)tr.GetChildAt(j); tvH = (TextView)trH.GetChildAt(j); tvH.SetWidth(tv.Width); } } }; }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { ((ViewHolder.timeLine)(holder)).created_.Text = DateTime.Parse(rows_[position].createdAt_).ToString("HH:mm:ss"); ((ViewHolder.timeLine)(holder)).content_.Text = rows_[position].content_; ((ViewHolder.timeLine)(holder)).content_.Enabled = rows_[position].enabled; ((ViewHolder.timeLine)(holder)).content_.Click += (sender, e) => { TableLayout tableLayout = new TableLayout(activity_.ApplicationContext); tableLayout.SetGravity(GravityFlags.Bottom | GravityFlags.CenterHorizontal); tableLayout.SetBackgroundColor(Color.Argb(100, 160, 160, 160)); activity_.AddContentView(tableLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); WindowManagerLayoutParams layoutParams = new WindowManagerLayoutParams( 600, 600, WindowManagerTypes.SystemOverlay, WindowManagerFlags.NotTouchable | WindowManagerFlags.NotFocusable, Android.Graphics.Format.Translucent); ImageView imageView = new ImageView(activity_.ApplicationContext); imageView.SetImageResource(awesome.Resource.Drawable.met); imageView.SetPadding(0, 0, 0, 50); tableLayout.AddView(imageView, layoutParams); var upAnimation = new Utilities.Animation.Horizontal() .StartPos(imageView.GetX(), imageView.GetY()) .MoveDistance(-80) .Duration(100) .Build(); var downAnimation = new Utilities.Animation.Horizontal() .StartPos(imageView.GetX(), imageView.GetY() - 80) .MoveDistance(80) .Duration(100) .Build(); imageView.StartAnimation(upAnimation); upAnimation.AnimationEnd += (_1, _2) => { imageView.StartAnimation(downAnimation); }; downAnimation.AnimationEnd += (_1, _2) => { imageView.StartAnimation(upAnimation); }; new Handler().PostDelayed(() => { ((ViewGroup)tableLayout.Parent).RemoveView(tableLayout); }, 500); onRowClicked(rows_[position]); ((Android.Widget.TextView)sender).Enabled = false; rows_[position].enabled = false; }; }
private void UpdateHeartView() { TableLayout tableLayout = FindViewById <TableLayout>(Resource.Id.tableLayout1); tableLayout.RemoveAllViews(); List <TsumTsumSender> tableList; int sortingType = Settings.GetInt("sortingType", 0); switch (sortingType) { case 0: // Alphabetic tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY SenderName COLLATE NOCASE ASC, HeartCount DESC"); break; case 1: // Heartcount tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY HeartCount DESC, SenderName COLLATE NOCASE ASC"); break; case 2: // Time (TODO) tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY LastReceiveTimestamp DESC, SenderName COLLATE NOCASE ASC"); break; default: throw new NotImplementedException(); } tableLayout.AddView(CreateRow("#", "Name", "Total", "Last Received", true), 0); for (int i = 0; i < tableList.Count; i++) { TsumTsumSender sender = tableList[i]; TableRow row = CreateRow( (i + 1).ToString(), sender.SenderName, sender.HeartCount.ToString(), string.Format("{0} {1}", sender.LastReceiveTimestamp.ToString("t"), sender.LastReceiveTimestamp.ToString("d")) ); tableLayout.AddView(row, i + 1); } }
public void SetMathWithAnswersTable(Operacije pOperacija, TableLayout pTable) { List <CRecord> listOfRecords = App.db.GetTopThreeRecords(pOperacija, App.MathWithAnswersCode); pTable.RemoveAllViews(); if (listOfRecords == null || listOfRecords.Count == 0) { var prazanRed = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null); prazanRed.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = GetString(Resource.String.nema_rezultata); pTable.AddView(prazanRed); return; } var zaglavlje = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null); zaglavlje.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = GetString(Resource.String.tacnih_odgovora); zaglavlje.FindViewById <TextView>(Resource.Id.vreme).Text = GetString(Resource.String.vreme); pTable.AddView(zaglavlje); int i = 0; foreach (var record in listOfRecords) { var view = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null); if (i == 0) { view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_g); } else if (i == 1) { view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_s); } else if (i == 2) { view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_b); } view.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = record.Result.ToString(); view.FindViewById <TextView>(Resource.Id.vreme).Text = record.Time.ToString(); pTable.AddView(view); i++; } }
void ShowConfirmacion() { AlertDialog.Builder builder = new AlertDialog.Builder(this); View customView = LayoutInflater.Inflate(Resource.Layout.DetallesReservacionLayout, null, true); TableLayout tlReservaciones = customView.FindViewById <TableLayout>(Resource.Id.tlReservaciones); LayoutInflater li = LayoutInflater; View detalleView = li.Inflate(Resource.Layout.DetallesReservacionSalaJuntaLayout, null, true); detalleView.FindViewById <TextView>(Resource.Id.lblSalasJuntas).Text = sala_seleccionada.Sala_Descripcion; detalleView.FindViewById <TextView>(Resource.Id.lblPiso).Text = "Nivel " + sala_seleccionada.Sala_Nivel; detalleView.FindViewById <TextView>(Resource.Id.lblFechaNumero).Text = DateTime.Parse(fecha_seleccionada).ToString("M"); detalleView.FindViewById <TextView>(Resource.Id.lblHorario).Text = hora_inicio_seleccionada + " - " + hora_fin_seleccionada; TableRow row = new TableRow(this); row.AddView(detalleView); tlReservaciones.AddView(row); customView.FindViewById <Button>(Resource.Id.btnCancelar).Click += (sender, e) => dialog.Dismiss(); customView.FindViewById <Button>(Resource.Id.btnConfirmar).Click += delegate { string correoInvitacion = new StreamReader(Assets.Open("SalaJuntasReserva.html")).ReadToEnd(); new Emails().SendMail(usuario.Usuario_Correo_Electronico, usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos, correoInvitacion.Replace("{{NOMBRE}}", usuario.Usuario_Nombre + " " + usuario.Usuario_Apellidos) .Replace("{{NOMBRESALA}}", sala_seleccionada.Sala_Descripcion) .Replace("{{CAPACIDADSALA}}", sala_seleccionada.Sala_Capacidad) .Replace("{{DIALETRA}}", new CultureInfo("es-MX").DateTimeFormat.GetDayName(DateTime.Parse(fecha_seleccionada).DayOfWeek).Substring(0, 3)) .Replace("{{DIANUMERO}}", DateTime.Parse(fecha_seleccionada).Day.ToString()) .Replace("{{HORARIO}}", hora_inicio_seleccionada + " - " + hora_fin_seleccionada), "Worklabs - Confirmación de sala de junta"); if (SalasController.AsignarSalaJuntas("ALTA", sala_seleccionada.Sala_Id, storage.Get("Usuario_Id"), storage.Get("Usuario_Tipo"), DateTime.Parse(fecha_seleccionada), hora_inicio_seleccionada, hora_fin_seleccionada, CalcularCreditos().ToString()) == -1) { SlackLogs.SendMessage("ERROR: Registro de sala de junta", GetType().Name, "ShowConfirmacion"); } dialog.Dismiss(); SetContentView(Resource.Layout.SalasJuntasConfirmacionLayout); FindViewById <TextView>(Resource.Id.lblDiaSemana).Text = new CultureInfo("es-MX").DateTimeFormat.GetDayName(DateTime.Parse(fecha_seleccionada).DayOfWeek).Substring(0, 3); FindViewById <TextView>(Resource.Id.lblDiaNumero).Text = DateTime.Parse(fecha_seleccionada).Day.ToString(); FindViewById <TextView>(Resource.Id.lblHorario).Text = hora_inicio_seleccionada + " - " + hora_fin_seleccionada; FindViewById <Button>(Resource.Id.btnContinuar).Click += delegate { StartActivity(new Intent(this, typeof(TabSalasJuntasHistorialActivity))); Finish(); }; }; builder.SetView(customView); builder.Create(); dialog = builder.Show(); dialog.Window.SetGravity(GravityFlags.Top | GravityFlags.Center); }
public List <FavoriteElementId> SetTableData(List <FavoriteData> favorites, Context context, Resources resources, TableLayout mTableLayout) { while (mTableLayout.ChildCount > 0) { mTableLayout.RemoveViewAt(0); } TableRow.LayoutParams tableRowLayoutparams = new TableRow.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); List <FavoriteElementId> response = new List <FavoriteElementId>(); Boolean colored = true; foreach (FavoriteData Row in favorites) { TableRow tr = new TableRow(context); if (colored) { tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult)); } colored = !colored; tr.LayoutParameters = tableRowLayoutparams; Boolean WITH_DIRECTION = Row.direction != null; TextView tv1 = new TextView(context); tv1.Text = Row.name + (WITH_DIRECTION ? " " + Row.direction : ""); tv1.TextAlignment = TextAlignment.ViewEnd; tv1.SetPadding(0, 0, 13, 0); tv1.SetMinimumWidth(320); tv1.SetTextSize(Android.Util.ComplexUnitType.Dip, WITH_DIRECTION ? 14 : 22); tv1.SetMaxWidth(1000); ImageButton deleteBtn = new ImageButton(context); deleteBtn.SetImageResource(Android.Resource.Drawable.IcMenuDelete); deleteBtn.SetMaxWidth(30); deleteBtn.SetBackgroundColor(Android.Graphics.Color.Transparent); deleteBtn.TextAlignment = TextAlignment.ViewEnd; tr.AddView(tv1); tr.AddView(deleteBtn); mTableLayout.AddView(tr); if (Row.direction == null) { response.Add(new FavoriteElementId(deleteBtn, tv1, Row.name, Row.searchType)); } else { response.Add(new FavoriteLineElementId(deleteBtn, tv1, Row.name, Row.searchType, Row.direction)); } } return(response); }
/// <summary> /// Initializes the layout of the game by inserting the row-templates into the table, setting the values of the /// layout-elements and applying click-events to the buttons. /// </summary> /// <param name="level">Level.</param> private void initGameLayout(int level) { if (level == 3) { for (int i = 0; i < level; i++) { View newRow = LayoutInflater.From(this).Inflate(Resource.Drawable.ThreeGame, null, false); gameTable.AddView(newRow); } View row1 = gameTable.GetChildAt(0); View row2 = gameTable.GetChildAt(1); View row3 = gameTable.GetChildAt(2); but1_1 = row1.FindViewById <Button> (Resource.Id.Three_1); but1_2 = row1.FindViewById <Button> (Resource.Id.Three_2); but1_3 = row1.FindViewById <Button> (Resource.Id.Three_3); but2_1 = row2.FindViewById <Button> (Resource.Id.Three_1); but2_2 = row2.FindViewById <Button> (Resource.Id.Three_2); but2_3 = row2.FindViewById <Button> (Resource.Id.Three_3); but3_1 = row3.FindViewById <Button> (Resource.Id.Three_1); but3_2 = row3.FindViewById <Button> (Resource.Id.Three_2); but3_3 = row3.FindViewById <Button> (Resource.Id.Three_3); buttonList.Add(but1_1); buttonList.Add(but1_2); buttonList.Add(but1_3); buttonList.Add(but2_1); buttonList.Add(but2_2); buttonList.Add(but2_3); buttonList.Add(but3_1); buttonList.Add(but3_2); buttonList.Add(but3_3); but1_1.Click += delegate { clickEvent(but1_1, 0); }; but1_2.Click += delegate { clickEvent(but1_2, 1); }; but1_3.Click += delegate { clickEvent(but1_3, 2); }; but2_1.Click += delegate { clickEvent(but2_1, 3); }; but2_2.Click += delegate { clickEvent(but2_2, 4); }; but2_3.Click += delegate { clickEvent(but2_3, 5); }; but3_1.Click += delegate { clickEvent(but3_1, 6); }; but3_2.Click += delegate { clickEvent(but3_2, 7); }; but3_3.Click += delegate { clickEvent(but3_3, 8); }; pauseButton.Click += delegate { pauseGame(paused); }; } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Create your application here var container = new LinearLayout (this) { Background=Android.Graphics.Color.Yellow.ToDrawable(), }; SetContentView (container); var table = new TableLayout (this) { Background=Android.Graphics.Color.Red.ToDrawable(), StretchAllColumns=true, // カラムを均等割にする WeightSum=rows, // 行を均等割にしたいので行数を指定 }; container.AddView (table, new LinearLayout.LayoutParams ( LinearLayout.LayoutParams.MatchParent, // 幅は親に合わせる LinearLayout.LayoutParams.MatchParent) // 高さは親に合わせる ); for (int i = 0; i < rows; i++) { var rowlayouts = new TableLayout.LayoutParams ( TableLayout.LayoutParams.WrapContent, TableLayout.LayoutParams.WrapContent) { Weight = 1, // テーブルの中で均等割するので全ての重みを1にする Height=0 // 高さを自動指定 }; var row = new TableRow (this); table.AddView (row, rowlayouts); for (int j = 0; j < cols; j++) { var buttonlayout = new TableRow.LayoutParams ( TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent // 高さは行に合わせる ) { Width = 0, // 幅を自動設定 RightMargin = 4, // 隙間を開ける TopMargin = 4 // 隙間を開ける }; var button = new Button (this) { Text=$"{i}-{j}", Background=Android.Graphics.Color.Blue.ToButtonPressEffect() }; row.AddView (button, buttonlayout); } } }
protected override void OnCreate(Bundle bundle) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(bundle); var tableLayout = new TableLayout(this); tableLayout.LayoutParameters = new TableLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); TableRow tableRow1 = new TableRow(this); TableRow tableRow2 = new TableRow(this); var aTextView1 = new TextView(this); aTextView1.Text = "A TextView"; var aTextView2 = new TextView(this); aTextView2.Text = "And another!"; tableRow1.AddView(aTextView1, 0); tableRow1.AddView(aTextView2, 1); var aButton1 = new Button(this); aButton1.Text = "Click Me!"; var aButton2 = new Button(this); aButton2.Text = "Or Me!"; tableRow2.AddView(aButton1, 0); tableRow2.AddView(aButton2, 1); tableLayout.AddView(tableRow1, 0); tableLayout.AddView(tableRow2, 1); SetContentView(tableLayout); }
private void tableRows_set(int row_count, TableLayout game_field)//beállitm egy sor paraméterit a legalapabb dolgokat { tableRows = new TableRow[row_count]; for (int i = 0; i < row_count; i++) { tableRows[i] = new TableRow(parent_context); tableRows[i].LayoutParameters = new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent); game_field.AddView(tableRows[i]); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); TableLayout playsTable = FindViewById <TableLayout>(Resource.Id.PlaysTable); string applicationDirectory = System.IO.Path.Combine("/storage", "emulated", "legacy", "Phonograph"); if (!System.IO.Directory.Exists(applicationDirectory)) { System.IO.Directory.CreateDirectory(applicationDirectory); } string databasePath = System.IO.Path.Combine(applicationDirectory, "PlaysDatabase.sqlite3"); var pdb = new Phonograph.Model.PhonographDatabase(databasePath); var plays = pdb.Query <PlaysView>( @"select p.id as ""Id"", t.title as ""TrackTitle"", a.title as ""AlbumTitle"", ar.name as ""ArtistName"", s.name as ""SourceName"", p.time as ""Time"" from plays p inner join tracks t on p.track_id = t.id inner join albums a on t.album_id = a.id inner join artists ar on t.artist_id = ar.id inner join sources s on p.source_id = s.id order by p.time desc limit 200"); foreach (var p in plays) { TableRow newRow = new TableRow(this); TextView tvTrack = new TextView(this); tvTrack.SetText(p.TrackTitle, TextView.BufferType.Normal); TextView tvArtist = new TextView(this); tvArtist.SetText(p.ArtistName, TextView.BufferType.Normal); TextView tvAlbum = new TextView(this); tvAlbum.SetText(p.AlbumTitle, TextView.BufferType.Normal); TextView tvSource = new TextView(this); tvSource.SetText(p.SourceName, TextView.BufferType.Normal); TextView tvTime = new TextView(this); tvTime.SetText(p.Time.ToString(), TextView.BufferType.Normal); newRow.AddView(tvTrack); newRow.AddView(tvArtist); newRow.AddView(tvAlbum); newRow.AddView(tvSource); newRow.AddView(tvTime); playsTable.AddView(newRow); } StartService(new Intent(this, typeof(PhonographService))); }
private void InsertInfo(string status, string time) { var row = CreateTableRow(status, time); if (row == null) { return; } lock (_insertLock) { _layout.AddView(row, 1); } }
protected override void OnPostExecute(string result) { TextView tv = present_Activity.FindViewById <TextView>(Resource.Id.textViewStatus); tv.Text = result; TableLayout tl = (TableLayout)present_Activity.FindViewById(Resource.Id.tableView); tl.RemoveAllViews(); foreach (TableRow row in rows) { tl.AddView(row); } }
public void Refresh() { hScroll.RemoveAllViews(); var t = new TableLayout(this); foreach (Account a in Db.getAccounts()) { var tr = new TableRow(this); var b = new Button(this); b.Text = a.account_name; b.Tag = a.account_id; b.Click += Account_Click; tr.AddView(b); t.AddView(tr); } hScroll.AddView(t); }
void AppendRow (TableLayout table) { TableRow row = new TableRow (this); TextView label = new TextView (this); label.SetText (Resource.String.table_layout_8_quit); label.SetPadding (3, 3, 3, 3); TextView shortcut = new TextView (this); shortcut.SetText (Resource.String.table_layout_8_ctrlq); shortcut.SetPadding (3, 3, 3, 3); shortcut.Gravity = GravityFlags.Right | GravityFlags.Top; row.AddView (label, new TableRow.LayoutParams (1)); row.AddView (shortcut, new TableRow.LayoutParams ()); table.AddView (row, new TableLayout.LayoutParams ()); }
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; drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave; drugInfoValueDialog.Show (trans, "dialog fragment"); Log.Info ("ifSignInButton", "Click"); }; // string value = GetDrugInfoValue (attendace.results, info.id, drug.id); if (string.IsNullOrEmpty (value)) { ImageView iv = new ImageView (Activity); iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp); rl.SetBackgroundColor (Android.Graphics.Color.LightPink); // rl.SetBackgroundResource(Resource.Style.alert_success); rl.AddView (iv); } else { TextView vvv = new TextView (Activity); vvv.Gravity = GravityFlags.Center; vvv.Text = value; vvv.SetTextAppearance (Activity, Resource.Style.text_success); // vvv.SetTextSize (ComplexUnitType.Sp, 24); // vvv.SetTextColor(Android.Graphics.Color.Argb); rl.SetBackgroundColor (Android.Graphics.Color.LightGreen); rl.AddView (vvv); } rr.AddView (rl); } // for (int i = 0; i < 2; i++) { // Values // ImageView iv = new ImageView (Activity); // iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp); // rr.AddView (iv); // } tl.AddView (rr); } r.AddView (tl); table.AddView (r); } }
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++; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView (Resource.Layout.ReportList); inflater = (LayoutInflater)GetSystemService(Context.LayoutInflaterService); tlHeader = FindViewById <TableLayout> (Resource.Id.tlHeader); MakeTableHeader (); tlContent = FindViewById <TableLayout> (Resource.Id.tlContent); //var dummy = new TableRow (this); int maxFIOLength = 0; int docID = 0; var hospitals = HospitalManager.GetHospitals ().OrderBy(h=>h.Name).ToList(); foreach (Hospital hosp in hospitals) { var doctors = DoctorManager.GetDoctors (hosp.ID).OrderBy(d=>d.SecondName).ToList(); if (doctors.Count > 0) { TableRow hview = (TableRow)inflater.Inflate (Resource.Layout.TableRow, null); hview.FindViewById <TextView> (Resource.Id.txtFIO).Text = hosp.Name; hview.FindViewById <TextView> (Resource.Id.txtFIO).SetBackgroundResource (Resource.Drawable.border_blue); hview.FindViewById <TextView> (Resource.Id.txtFIO).SetTextColor (Android.Graphics.Color.Black); hview.FindViewById <TextView> (Resource.Id.txtFIO).SetShadowLayer (0, 0, 0, Android.Graphics.Color.Black); foreach (int weekNum in listOfWeekNum) { TextView hviewVisitCount = (TextView)inflater.Inflate (Resource.Layout.TableVisitCount, null); hviewVisitCount.Text = ""; hviewVisitCount.SetBackgroundResource (Resource.Drawable.border_blue); hviewVisitCount.SetTextColor (Android.Graphics.Color.Black); hview.AddView (hviewVisitCount); } tlContent.AddView (hview); } foreach (Doctor doc in doctors) { TableRow view = (TableRow)inflater.Inflate (Resource.Layout.TableRow, null); view.FindViewById <TextView> (Resource.Id.txtFIO).Text = doc.FIO () + "\n" + doc.Speciality; if (maxFIOLength < view.FindViewById <TextView> (Resource.Id.txtFIO).Text.Length) { maxFIOLength = view.FindViewById <TextView> (Resource.Id.txtFIO).Text.Length; docID = doc.ID; } var report = ReportManager.GetReport (doc.ID); foreach (int weekNum in listOfWeekNum) { TextView viewVisitCount = (TextView)inflater.Inflate (Resource.Layout.TableVisitCount, null); if (report == null) { viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = "0"; } else { int visitCount = report.FindVisitCountValue (weekNum); viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = visitCount.ToString (); switch (visitCount) { case 0: break; case 1: viewVisitCount.SetBackgroundResource (Resource.Drawable.border_green); viewVisitCount.SetTextColor (Android.Graphics.Color.Black); break; default: viewVisitCount.SetBackgroundResource (Resource.Drawable.border_red); viewVisitCount.SetTextColor (Android.Graphics.Color.Black); break; } } viewVisitCount.LayoutParameters = new TableRow.LayoutParams (TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent); view.AddView (viewVisitCount); } tlContent.AddView (view); } } var doctorsWithoutHospitals = DoctorManager.GetDoctors (-1).OrderBy(d=>d.SecondName).ToList(); foreach (Doctor doc in doctorsWithoutHospitals) { TableRow view = (TableRow)inflater.Inflate (Resource.Layout.TableRow, null); view.FindViewById <TextView> (Resource.Id.txtFIO).Text = doc.FIO (); if (maxFIOLength < view.FindViewById <TextView> (Resource.Id.txtFIO).Text.Length) { maxFIOLength = view.FindViewById <TextView> (Resource.Id.txtFIO).Text.Length; docID = doc.ID; } var report = ReportManager.GetReport (doc.ID); foreach (int weekNum in listOfWeekNum) { TextView viewVisitCount = (TextView)inflater.Inflate (Resource.Layout.TableVisitCount, null); if (report == null) { viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = "0"; } else { int visitCount = report.FindVisitCountValue (weekNum); viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = visitCount.ToString (); switch (visitCount) { case 0: break; case 1: viewVisitCount.SetBackgroundResource (Resource.Drawable.border_green); viewVisitCount.SetTextColor (Android.Graphics.Color.Black); break; default: viewVisitCount.SetBackgroundResource (Resource.Drawable.border_red); viewVisitCount.SetTextColor (Android.Graphics.Color.Black); break; } viewVisitCount.SetTextColor (Android.Graphics.Color.Black); } viewVisitCount.LayoutParameters = new TableRow.LayoutParams (TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent); view.AddView (viewVisitCount); } tlContent.AddView (view); } if (docID != 0) { TableRow dummyView = (TableRow)inflater.Inflate(Resource.Layout.TableRow, null); dummyView.FindViewById <TextView> (Resource.Id.txtFIO).Text = DoctorManager.GetDoctor (docID).FIO (); var report = ReportManager.GetReport (docID); foreach (int weekNum in listOfWeekNum) { TextView viewVisitCount = (TextView)inflater.Inflate (Resource.Layout.TableVisitCount, null); //viewVisitCount.LayoutParameters = new TableRow.LayoutParams( if (report == null) { viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = "0"; } else { viewVisitCount.FindViewById <TextView> (Resource.Id.txtVisitCount).Text = weekNum.ToString(); } viewVisitCount.LayoutParameters = new TableRow.LayoutParams (TableRow.LayoutParams.MatchParent, 0); dummyView.AddView (viewVisitCount); } dummyView.FindViewById <TextView> (Resource.Id.txtFIO).LayoutParameters.Height = 0; tlHeader.AddView (dummyView); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); layoutInflater = inflater; View rootView = inflater.Inflate(Resource.Layout.PharmacyFragment, container, false); pfSearchEdit = rootView.FindViewById<EditText> (Resource.Id.pfSearchEdit); pfSearchEdit.TextChanged += SearchEdit_TextChanged; pfPharmacyAddButton = rootView.FindViewById<Button> (Resource.Id.pfPharmacyAddButton); pfPharmacyAddButton.Click += PharmacyAddButton_Click; pfPharmacyTable = rootView.FindViewById<TableLayout> (Resource.Id.pfPharmacyTable); pfPharmacyTableHeader = rootView.FindViewById<TableLayout> (Resource.Id.pfPharmacyTableHeader); pfContent = rootView.FindViewById<LinearLayout> (Resource.Id.pfContent); // pfPharmacyTableHeaderRow = rootView.FindViewById<TableRow> (Resource.Id.pfPharmacyTableHeaderRow); pfAddPharmacy = rootView.FindViewById<TextView> (Resource.Id.pfAddPharmacy); pfAddPharmacy.Click += PharmacyAddButton_Click; //Add Header Row TableRow row = new TableRow (Activity); row.SetBackgroundResource(Resource.Drawable.bottomline); TextView id = GetHeadItem (ColumnPosition.cpFirst); id.Gravity = GravityFlags.Center; id.Text = @"ID"; row.AddView (id); TextView fullName = GetHeadItem (ColumnPosition.cpMiddle); fullName.Gravity = GravityFlags.CenterVertical; fullName.Text = @"Full Name"; row.AddView (fullName); TextView shortName = GetHeadItem (ColumnPosition.cpMiddle); shortName.Gravity = GravityFlags.CenterVertical; shortName.Text = @"Short Name"; row.AddView (shortName); TextView officialName = GetHeadItem (ColumnPosition.cpMiddle); officialName.Gravity = GravityFlags.CenterVertical; officialName.Text = @"Official Name"; row.AddView (officialName); TextView address = GetHeadItem (ColumnPosition.cpMiddle); address.Gravity = GravityFlags.CenterVertical; address.Text = @"Address"; row.AddView (address); TextView subway = GetHeadItem (ColumnPosition.cpMiddle); subway.Gravity = GravityFlags.CenterVertical; subway.Text = @"Subway"; row.AddView (subway); TextView phone = GetHeadItem (ColumnPosition.cpMiddle); phone.Gravity = GravityFlags.CenterVertical; phone.Text = @"Phone"; row.AddView (phone); TextView email = GetHeadItem (ColumnPosition.cpMiddle); email.Gravity = GravityFlags.CenterVertical; email.Text = @"E-mail"; row.AddView (email); TextView delete = GetHeadItem (ColumnPosition.cpLast); delete.Gravity = GravityFlags.CenterVertical; delete.Text = @"Actions"; row.AddView (delete); pfPharmacyTableHeader.AddView(row); //Add Header Row row2 = new TableRow (Activity); row2.SetBackgroundResource(Resource.Drawable.bottomline); TextView id2 = GetHeadItem (ColumnPosition.cpFirst); id2.Gravity = GravityFlags.Center; id2.Text = @"ID"; row2.AddView (id2); TextView fullName2 = GetHeadItem (ColumnPosition.cpMiddle); fullName2.Gravity = GravityFlags.CenterVertical; fullName2.Text = @"Full Name"; row2.AddView (fullName2); TextView shortName2 = GetHeadItem (ColumnPosition.cpMiddle); shortName2.Gravity = GravityFlags.CenterVertical; shortName2.Text = @"Short Name"; row2.AddView (shortName2); TextView officialName2 = GetHeadItem (ColumnPosition.cpMiddle); officialName2.Gravity = GravityFlags.CenterVertical; officialName2.Text = @"Official Name"; row2.AddView (officialName2); TextView address2 = GetHeadItem (ColumnPosition.cpMiddle); address2.Gravity = GravityFlags.CenterVertical; address2.Text = @"Address"; row2.AddView (address2); TextView subway2 = GetHeadItem (ColumnPosition.cpMiddle); subway2.Gravity = GravityFlags.CenterVertical; subway2.Text = @"Subway"; row2.AddView (subway2); TextView phone2 = GetHeadItem (ColumnPosition.cpMiddle); phone2.Gravity = GravityFlags.CenterVertical; phone2.Text = @"Phone"; row2.AddView (phone2); TextView email2 = GetHeadItem (ColumnPosition.cpMiddle); email2.Gravity = GravityFlags.CenterVertical; email2.Text = @"E-mail"; row2.AddView (email2); TextView delete2 = GetHeadItem (ColumnPosition.cpLast); delete2.Gravity = GravityFlags.CenterVertical; delete2.Text = @"Actions"; row2.AddView (delete2); pfPharmacyTable.AddView (row2); // // foreach (var pharmacy in pharmacies) { // TableRow row = new TableRow (this.Activity); // // TextView id = new TextView (this.Activity); // id.Text = pharmacy.id.ToString (); // row.AddView (id); // // TextView fullName = new TextView (this.Activity); // fullName.Text = pharmacy.fullName; // row.AddView (fullName); // // TextView address = new TextView (this.Activity); // address.Text = pharmacy.address; // row.AddView (address); // // pfPharmacyTable.AddView(row); // } return rootView; }
void BuildUI () { var hmargin = 12; var content = new LinearLayout (this) { Orientation = Orientation.Vertical, }; var scroller = new ScrollView (this) { }; scroller.AddView (content); SetContentView (scroller); // // Fields // var fields = new TableLayout (this) { LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 12, LeftMargin = hmargin, RightMargin = hmargin, }, }; fields.SetColumnStretchable (1, true); foreach (var f in state.Authenticator.Fields) { var row = new TableRow (this); var label = new TextView (this) { Text = f.Title, LayoutParameters = new TableRow.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) { RightMargin = 6, }, }; label.SetTextSize (ComplexUnitType.Sp, 20); row.AddView (label); var editor = new EditText (this) { Hint = f.Placeholder, }; row.AddView (editor); fieldEditors [f] = editor; fields.AddView (row); } content.AddView (fields); // // Buttons // var signInLayout = new LinearLayout (this) { Orientation = Orientation.Horizontal, LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 24, LeftMargin = hmargin, RightMargin = hmargin, }, }; content.AddView (signInLayout); progress = new ProgressBar (this) { Visibility = state.IsSigningIn ? ViewStates.Visible : ViewStates.Gone, Indeterminate = true, }; signInLayout.AddView (progress); signIn = new Button (this) { Text = "Sign In", LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { }, }; signIn.Click += HandleSignIn; signInLayout.AddView (signIn); if (state.Authenticator.CreateAccountLink != null) { var createAccount = new Button (this) { Text = "Create Account", LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent) { TopMargin = 12, LeftMargin = hmargin, RightMargin = hmargin, }, }; createAccount.Click += HandleCreateAccount; content.AddView (createAccount); } }
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); // vvv.SetTextSize (ComplexUnitType.Sp, 24); // vvv.SetTextColor(Android.Graphics.Color.Argb); rl.SetBackgroundColor (Android.Graphics.Color.LightGreen); } vvv.Text = AttendanceResult.StringBoolToRussian(value); rl.AddView (vvv); rr.AddView (rl); } tl.AddView (rr); } r.AddView (tl); table.AddView (r); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.TransactionEdit); hScroll = FindViewById<LinearLayout>(Resource.Id.hScroll); txtTitle = FindViewById<EditText>(Resource.Id.txtTitle); txtTransactionDate = FindViewById<EditText>(Resource.Id.txtTransactionDate); txtTransactionDate.Click+=txtTransactionDate_Click; txtComments = FindViewById<EditText>(Resource.Id.txtComments); chkIsActive = FindViewById<CheckBox>(Resource.Id.chkIsActive); txtTotal = FindViewById<TextView>(Resource.Id.txtTotal); txtComments.SetMinWidth(WindowManager.DefaultDisplay.Width); FindViewById<Button>(Resource.Id.btnSave).Click += btnSave_Click; transaction_id = Intent.GetStringExtra("transaction_id"); if (Convert.ToString(Intent.GetStringExtra("account_id")) == "") throw new Exception("cannot create or edit a transaction without an account"); //create amount inputs var t = new TableLayout(this); t.StretchAllColumns = true; foreach (Fund f in Db.getFunds()) { var tr = new TableRow(this); var lbl = new TextView(this); lbl.Text = f.fund_name; var txt = new EditText(this); txt.SetMinWidth(50); amounts.Add(txt); txt.AfterTextChanged += Amount_Change; txt.Tag = f.fund_id; tr.AddView(lbl); tr.AddView(txt); t.AddView(tr); } hScroll.AddView(t); //load fields from database if (transaction_id == "") { account_id = Intent.GetStringExtra("account_id"); txtTransactionDate.Text=DateTime.Now.ToShortDateString(); } else { var transaction = Db.getTransaction(transaction_id); chkIsActive.Checked = transaction.is_active == "1"; txtComments.Text = transaction.transaction_comment; txtTitle.Text = transaction.transaction_title; txtTransactionDate.Text = transaction.transaction_date.ToShortDateString(); account_id = transaction.account_id; var details = Db.getTransactionDetails(transaction_id); foreach (TransactionDetail td in details) { foreach (EditText et in amounts) { if (Convert.ToString(et.Tag) == td.fund_id) et.Text = td.comment; } } } Android.Util.Log.Info("account_id", account_id); }