protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            _fab             = FindViewById <Fab>(Resource.Id.button_floating_action);
            _fab.FabColor    = Color.Purple;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_profil_plus);
        }
Exemple #2
0
        private void SetupFab()
        {
            Fab  fab        = (Fab)FindViewById(Resource.Id.fab);
            View sheetView  = FindViewById(Resource.Id.fab_sheet);
            View overlay    = FindViewById(Resource.Id.overlay);
            int  sheetColor = Resources.GetColor(Resource.Color.background_card);
            int  fabColor   = Resources.GetColor(Resource.Color.theme_accent);

            // Create material sheet FAB
            materialSheetFab = new MaterialSheetFab(fab, sheetView, overlay, sheetColor, fabColor);

            // Set material sheet event listener
            materialSheetFab.SetEventListener(new FabListener(this));

            // Set material sheet item click listeners
            FindViewById(Resource.Id.fab_sheet_item_recording).SetOnClickListener(this);
            FindViewById(Resource.Id.fab_sheet_item_reminder).SetOnClickListener(this);
            FindViewById(Resource.Id.fab_sheet_item_photo).SetOnClickListener(this);
            FindViewById(Resource.Id.fab_sheet_item_note).SetOnClickListener(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            _fab             = FindViewById <Fab>(Resource.Id.fabbutton);
            _fab.FabColor    = Color.White;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_edit);
            _fab.Click      += (s, e) => Toast.MakeText(this, "Clicked Fab", ToastLength.Short).Show();
            ActionBar.SetBackgroundDrawable(new ColorDrawable(Color.Black));

            var blue = FindViewById <View>(Resource.Id.blueButton);

            blue.Click += (s, e) =>
            {
                var holoBlue = Resources.GetColor(Android.Resource.Color.HoloBlueLight);
                _fab.FabColor = holoBlue;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoBlue));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var purple = FindViewById <View>(Resource.Id.purpleButton);

            purple.Click += (s, e) =>
            {
                var holoPurple = Resources.GetColor(Android.Resource.Color.HoloPurple);
                _fab.FabColor = holoPurple;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoPurple));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_av_play);
            };

            var green = FindViewById <View>(Resource.Id.greenButton);

            green.Click += (s, e) =>
            {
                var holoGreen = Resources.GetColor(Android.Resource.Color.HoloGreenLight);
                _fab.FabColor = holoGreen;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoGreen));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_discard);
            };

            var oraange = FindViewById <View>(Resource.Id.orangeButton);

            oraange.Click += (s, e) =>
            {
                var holoOrange = Resources.GetColor(Android.Resource.Color.HoloOrangeLight);
                _fab.FabColor = holoOrange;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoOrange));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_social_add_person);
            };

            var red = FindViewById <View>(Resource.Id.redButton);

            red.Click += (s, e) =>
            {
                var holoRed = Resources.GetColor(Android.Resource.Color.HoloRedLight);
                _fab.FabColor = holoRed;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoRed));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_navigation_accept);
            };

            var hide = FindViewById <Button>(Resource.Id.hideButton);

            hide.Click += (s, e) =>
            {
                _fab.Hide();
                ActionBar.Hide();
            };

            var show = FindViewById <Button>(Resource.Id.showButton);

            show.Click += (s, e) =>
            {
                _fab.Show();
                ActionBar.Show();
            };
        }