public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); // Set heater value this.toggleButtons = new ToggleButtons(view, this.saunaModel); this.toggleButtons.UpdateToggleButtons(this.heaterModel.Status); this.toggleButtons.OnToggleChanged += ToggleButtons_OnToggleChanged; // Set segmented control power items, selection event and selected index this.sfSegmentedControlPower.DisplayMode = SegmentDisplayMode.Text; this.sfSegmentedControlPower.SegmentHeight = 33; this.sfSegmentedControlPower.SelectionTextColor = Color.DarkGreen; this.sfSegmentedControlPower.FontColor = Color.White; this.sfSegmentedControlPower.CornerRadius = 10; this.sfSegmentedControlPower.BackColor = Color.LightGray; this.sfSegmentedControlPower.BorderColor = Color.DarkGreen; this.sfSegmentedControlPower.BorderThickness = 2; this.sfSegmentedControlPower.VisibleSegmentsCount = 3; this.sfSegmentedControlPower.ItemsSource = this.heterModelList; this.sfSegmentedControlPower.SelectedIndex = GetSelectedHeatingIndex(this.heterModelList, this.heaterModel); SelectionIndicatorSettings selectionIndicator = new SelectionIndicatorSettings(); selectionIndicator.Color = Color.White; this.sfSegmentedControlPower.SelectionIndicatorSettings = selectionIndicator; this.sfSegmentedControlPower.SelectionChanged += SfSegmentedControlPower_SelectionChanged; // Update selected edit temperature this.editTextTemperature.Text = this.heaterModel.TemperatureThreshold.ToString(); // Set values to heater sensors and recyclerview this.recyclerViewSensorTemperatures.SetAdapter(this.heaterSensorsAdapter); /* * Special type of layout manager for recycler view, developed by google: FlexLayoutManager * https://github.com/AigioL/XAB.FlexboxLayout * * Let's easily manage items when not using linearlayout manager. */ FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this.Activity, FlexDirection.Row, FlexWrap.Wrap); flexboxLayoutManager.JustifyContent = JustifyContent.Center; flexboxLayoutManager.AlignItems = AlignItems.Stretch; flexboxLayoutManager.FlexWrap = FlexWrap.Wrap; this.recyclerViewSensorTemperatures.SetLayoutManager(flexboxLayoutManager); this.recyclerViewSensorTemperatures.NestedScrollingEnabled = false; }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); this.recyclerViewSettings.SetAdapter(this.settingsListAdapter); // Create flexbox layout manager to fit all sizes of screens. FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this.Activity, FlexDirection.Row, FlexWrap.Wrap); flexboxLayoutManager.JustifyContent = JustifyContent.Center; flexboxLayoutManager.AlignItems = AlignItems.Stretch; flexboxLayoutManager.FlexWrap = FlexWrap.Wrap; this.recyclerViewSettings.SetLayoutManager(flexboxLayoutManager); this.settingsListAdapter.OnItemClick += SettingsListAdapter_OnItemClick; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); _presenter = new Presenter(); _list = _presenter.GetViewModel(); var recyclerView = FindViewById <RecyclerView>(Resource.Id.my_recycler_view); FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this); recyclerView.SetLayoutManager(flexboxLayoutManager); // recyclerView.SetLayoutManager(new LinearLayoutManager(this)); var adapter = new RecyclerViewAdapter(_list); recyclerView.SetAdapter(adapter); }