protected void AddFlowTag(string tag) { var flowView = LayoutInflater.From(Activity).Inflate(Resource.Layout.lyt_local_tags_item, null); var flowViewTag = flowView.FindViewById <TextView>(Resource.Id.tag); flowView.Tag = tag; flowViewTag.Text = tag; flowViewTag.Typeface = Style.Light; flowView.Click += (sender, args) => RemoveTag(tag); var margin = (int)BitmapUtils.DpToPixel(5, Resources); var layoutParams = new FlowLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); layoutParams.SetMargins(0, margin, margin, margin); flowView.LayoutParameters = layoutParams; _tagsFlow.AddView(flowView, layoutParams); }
private void AddView(Sponsor sponsor, FlowLayout container) { var imageView = new SponsorImageView(Activity); imageView.BindData(sponsor, (_, __) => { if (string.IsNullOrEmpty(sponsor.Url)) { return; } AnalyticsTracker.SendEvent("sponsor", sponsor.Url); AppUtil.ShowWebPage(Activity, sponsor.Url); }); var lparams = new FlowLayout.LayoutParams( FlowLayout.LayoutParams.WrapContent, FlowLayout.LayoutParams.WrapContent); int margin = (int) Resources.GetDimension(Resource.Dimension.spacing_small); lparams.SetMargins(margin, margin, 0, 0); container.AddView(imageView, lparams); }
private void AddView(Sponsor sponsor, FlowLayout container) { var imageView = new SponsorImageView(Activity); imageView.BindData(sponsor, (_, __) => { if (string.IsNullOrEmpty(sponsor.Url)) { return; } AnalyticsTracker.SendEvent("sponsor", sponsor.Url); AppUtil.ShowWebPage(Activity, sponsor.Url); }); var lparams = new FlowLayout.LayoutParams( FlowLayout.LayoutParams.WrapContent, FlowLayout.LayoutParams.WrapContent); int margin = (int)Resources.GetDimension(Resource.Dimension.spacing_small); lparams.SetMargins(margin, margin, 0, 0); container.AddView(imageView, lparams); }