コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var exampleCorners     = FindViewById <BootstrapButton>(Resource.Id.bbutton_example_corners);
            var exampleOutline     = FindViewById <BootstrapButton>(Resource.Id.bbutton_example_outline);
            var exampleSize        = FindViewById <BootstrapButton>(Resource.Id.bbutton_example_size);
            var exampleTheme       = FindViewById <BootstrapButton>(Resource.Id.bbutton_example_theme);
            var exampleCustomStyle = FindViewById <BootstrapButton>(Resource.Id.example_bbutton_custom_style);


            // create a custom bootstrap size
            exampleCustomStyle.SetBootstrapSize(DefaultBootstrapSize.Sm);

            // create a Bootstrap Theme with holo colors
            exampleCustomStyle.BootstrapBrand = new CustomBootstrapStyle(this);


            exampleCorners.SetOnClickListener(new ViewOnClick(v => { exampleCorners.Rounded = !exampleCorners.Rounded; }));
            exampleOutline.SetOnClickListener(new ViewOnClick(v => { exampleOutline.ShowOutline = !exampleOutline.ShowOutline; }));
            exampleSize.SetOnClickListener(new ViewOnClick(v =>
            {
                size = size.ChangeBootstrapSize();
                exampleSize.SetBootstrapSize(size);
            }));
            exampleTheme.SetOnClickListener(new ViewOnClick(v =>
            {
                exampleTheme.ChangeBootstrapBrand();
            }));
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var changeEnabled = FindViewById <BootstrapEditText>(Resource.Id.bedit_text_change_enabled);
            var changeRound   = FindViewById <BootstrapEditText>(Resource.Id.bedit_text_change_round);
            var changeTheme   = FindViewById <BootstrapEditText>(Resource.Id.bedit_text_change_theme);
            var sizeExample   = FindViewById <BootstrapEditText>(Resource.Id.bedit_text_change_size);

            FindViewById <Button>(Resource.Id.bedit_text_change_enabled_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeEnabled.Enabled = !changeEnabled.Enabled;
            }));
            FindViewById <Button>(Resource.Id.bedit_text_change_round_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeRound.Rounded = !changeRound.Rounded;
            }));
            FindViewById <Button>(Resource.Id.bedit_text_change_theme_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeTheme.ChangeBootstrapBrand();
            }));
            FindViewById <Button>(Resource.Id.bedit_text_change_size_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                size = size.ChangeBootstrapSize();

                sizeExample.SetBootstrapSize(size);
            }));
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var imageChange        = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_image_change_example);
            var themeChange        = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_theme_change_example);
            var borderChange       = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_border_change_example);
            var roundedChange      = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_rounded_change_example);
            var sizeChange         = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_size_change_example);
            var setBitmapExample   = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_set_image_bitmap_example);
            var setDrawableExample = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_set_image_drawable_example);
            var setResourceExample = FindViewById <BootstrapThumbnail>(Resource.Id.bthumb_set_image_resource_example);

            var bm = BitmapFactory.DecodeResource(Resources, Resource.Drawable.small_daffodils);

            setBitmapExample.SetImageBitmap(bm);

            setDrawableExample.SetImageDrawable(Com.Beardedhen.Androidbootstrap.Utils.DrawableUtils.ResolveDrawable(Resource.Drawable.ladybird, this));

            setResourceExample.SetImageResource(Resource.Drawable.caterpillar);
            sizeChange.LayoutParameters = (GetLayoutParams(size.ScaleFactor()));

            imageChange.SetOnClickListener(new ViewOnClick(v =>
            {
                switch (resId)
                {
                case Resource.Drawable.ladybird:
                    resId = Resource.Drawable.caterpillar;
                    break;

                case Resource.Drawable.caterpillar:
                    resId = 0;
                    break;

                case 0:
                    resId = Resource.Drawable.ladybird;
                    break;
                }
                imageChange.SetImageResource(resId);
            }));
            themeChange.SetOnClickListener(new ViewOnClick(v =>
            {
                themeChange.ChangeBootstrapBrand();
            }));
            roundedChange.SetOnClickListener(new ViewOnClick(v =>
            {
                roundedChange.Rounded = !roundedChange.Rounded;
            }));
            borderChange.SetOnClickListener(new ViewOnClick(v =>
            {
                borderChange.BorderDisplayed = !borderChange.BorderDisplayed;
            }));
            sizeChange.SetOnClickListener(new ViewOnClick(v =>
            {
                size = size.ChangeBootstrapSize();
                sizeChange.SetBootstrapSize(size);
                sizeChange.LayoutParameters = GetLayoutParams(size.ScaleFactor());
            }));
        }
コード例 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var defaultExample     = FindViewById <BootstrapProgressBar>(Resource.Id.example_progress_default);
            var animatedExample    = FindViewById <BootstrapProgressBar>(Resource.Id.example_progress_animated);
            var stripedExample     = FindViewById <BootstrapProgressBar>(Resource.Id.example_progress_striped);
            var stripedAnimExample = FindViewById <BootstrapProgressBar>(Resource.Id.example_progress_striped_animated);
            var changeExample      = FindViewById <BootstrapProgressBar>(Resource.Id.example_progress_change);
            var sizeExample        = FindViewById <BootstrapProgressBar>(Resource.Id.example_size_change);


            FindViewById <Button>(Resource.Id.example_progress_default_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                defaultExample.Progress = RandomProgress(defaultExample.Progress, 100);
            }));

            FindViewById <Button>(Resource.Id.example_progress_animated_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                animatedExample.Progress = RandomProgress(animatedExample.Progress, 100);
            }));
            FindViewById <Button>(Resource.Id.example_progress_striped_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                stripedExample.Progress = RandomProgress(stripedExample.Progress, 100);
            }));
            FindViewById <Button>(Resource.Id.example_progress_striped_animated_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                stripedAnimExample.Progress = RandomProgress(stripedAnimExample.Progress, 100);
            }));
            FindViewById <Button>(Resource.Id.example_progress_change_type_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeState            = changeState.Next();
                changeExample.Striped  = changeState.Striped;
                changeExample.Animated = changeState.Animated;
            }));
            FindViewById <Button>(Resource.Id.example_progress_change_rounded_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeExample.Rounded = !changeExample.Rounded;
            }));
            FindViewById <Button>(Resource.Id.example_progress_change_color_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                changeExample.ChangeBootstrapBrand();
            }));
            FindViewById <Button>(Resource.Id.example_size_change_btn).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                size = size.ChangeBootstrapSize();
                sizeExample.SetBootstrapSize(size);
            }));
        }