Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Activity(Label = "SampleApp", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
- public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
- {
- App mainApp;
- protected override void OnCreate(Bundle bundle)
- {
- base.OnCreate(bundle);
- global::Xamarin.Forms.Forms.Init(this, bundle);
- mainApp = new App();
- mainApp.ScreenWidth = (int)Resources.DisplayMetrics.WidthPixels;
- mainApp.ScreenHeight = (int)Resources.DisplayMetrics.HeightPixels;
- mainApp.LoadHomePage();
- LoadApplication(mainApp);
- }
- public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
- {
- base.OnConfigurationChanged(newConfig);
- mainApp.ScreenWidth = (int)Resources.DisplayMetrics.WidthPixels;
- mainApp.ScreenHeight = (int)Resources.DisplayMetrics.HeightPixels;
- mainApp.LoadHomePage();
- }
- }
- int btnWidth = ScreenWidth / 5;
- StackLayout headerPaneLayout = new StackLayout();
- headerPaneLayout.Orientation = StackOrientation.Horizontal;
- headerPaneLayout.BackgroundColor = Color.Yellow;
- headerPaneLayout.Padding = new Thickness(0, 0, 0, 0);
- mainLayout.Children.Add(headerPaneLayout);
- Button btn1 = new Button();
- btn1 .Text = "Take Survey";
- btn1 .WidthRequest = btnWidth;
- btn1 .HorizontalOptions = LayoutOptions.Start;
- headerPaneLayout.Children.Add(btn1 );
- Button btn2 = new Button();
- btn2.Text = "PPE Product";
- btn2.WidthRequest = btnWidth;
- headerPaneLayout.Children.Add(btnPPEProduct);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement