Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "Custom Theme" layout resource
            SetContentView(Resource.Layout.CustomTheme);

            // Create intents for the other two theme activities:
            darkThemeActivity = new ActivityItem {
                Title = "Material Dark", Intent = new Intent(this, typeof(MaterialDarkActivity))
            };
            lightThemeActivity = new ActivityItem {
                Title = "Material Light", Intent = new Intent(this, typeof(MaterialLightActivity))
            };
            lightDarkBarThemeActivity = new ActivityItem {
                Title = "Material Dark Action Bar", Intent = new Intent(this, typeof(MaterialLightDarkBarActivity))
            };

            // Create buttons to select the other theme types:
            Button darkThemeBtn         = FindViewById <Button>(Resource.Id.materialDarkButton);
            Button lightThemeBtn        = FindViewById <Button>(Resource.Id.materialLightButton);
            Button lightDarkBarThemeBtn = FindViewById <Button>(Resource.Id.materialLightDarkBarButton);

            // Launch the Dark Theme activity if selected:
            darkThemeBtn.Click += delegate
            {
                StartActivity(darkThemeActivity.Intent);
            };

            // Launch the Light Theme activity if selected:
            lightThemeBtn.Click += delegate
            {
                StartActivity(lightThemeActivity.Intent);
            };

            // Launch the Light Theme with Dark Action Bar activity if selected:
            lightDarkBarThemeBtn.Click += delegate
            {
                StartActivity(lightDarkBarThemeActivity.Intent);
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "Dark Theme" layout resource
            SetContentView(Resource.Layout.DarkTheme);

            // Create intents for the other two theme activities:
            lightThemeActivity = new ActivityItem { 
                Title = "Material Light", Intent = new Intent(this, typeof(MaterialLightActivity)) };
            lightDarkBarThemeActivity = new ActivityItem { 
                Title = "Material Dark Action Bar", Intent = new Intent(this, typeof(MaterialLightDarkBarActivity)) };
            customThemeActivity = new ActivityItem { 
                Title = "Custom Theme", Intent = new Intent(this, typeof(MaterialCustomActivity)) };

            // Create buttons to select the other theme types:
            Button lightThemeBtn = FindViewById<Button>(Resource.Id.materialLightButton);
            Button lightDarkBarThemeBtn = FindViewById<Button>(Resource.Id.materialLightDarkBarButton);
            Button customThemeBtn = FindViewById<Button>(Resource.Id.customThemeButton);

            // Launch the Light Theme activity if selected:
            lightThemeBtn.Click += delegate
            {
                StartActivity(lightThemeActivity.Intent);
            };

            // Launch the Light Theme with Dark Action Bar activity if selected:
            lightDarkBarThemeBtn.Click += delegate
            {
                StartActivity(lightDarkBarThemeActivity.Intent);
            };

            // Launch the Custom Theme activity if selected:
            customThemeBtn.Click += delegate
            {
                StartActivity(customThemeActivity.Intent);
            };

        }