Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);
            
            var pos = 0;
            if (Intent.Extras != null)
                pos = Intent.Extras.GetInt("pos");

            var birds = Resources.GetStringArray(Resource.Array.birds);
            var imgs = Resources.ObtainTypedArray(Resource.Array.birds_img);
            var resId = imgs.GetResourceId(pos, -1);

            Title = birds[pos];
            Window.RequestFeature(WindowFeatures.ActionBarOverlay);
            var color = new ColorDrawable(Color.Black);
            color.SetAlpha(128);
            ActionBar.SetBackgroundDrawable(color);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            _handler = new Handler();

            var imageView = new ImageView(this);
            imageView.SetScaleType(ImageView.ScaleType.CenterInside);
            imageView.SetImageResource(resId);
            imageView.Click += (sender, args) =>
                {
                    ActionBar.Show();
                    HideActionBarDelayed(_handler);
                };
            SetContentView(imageView);
            Window.SetBackgroundDrawableResource(Android.Resource.Color.BackgroundDark);
        }
Exemplo n.º 2
0
        //@Override
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //Window.RequestFeature(WindowFeatures.ActionBarOverlay);
            int pos = 0;
            if (Intent.Extras != null)
            {
                pos = Intent.Extras.GetInt("pos");
            }

            string[] birds = Resources.GetStringArray(Resource.Array.birds);
            TypedArray imgs = Resources.ObtainTypedArray(Resource.Array.birds_img);
            int resId = imgs.GetResourceId(pos, -1);

            Title = birds[pos];
            //Window.RequestFeature(WindowFeatures.ActionBarOverlay);
            ColorDrawable color = new ColorDrawable(Color.Black);
            color.SetAlpha(128);

            SupportActionBar.SetBackgroundDrawable(color);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            mHandler = new Handler();

            ImageView imageView = new ImageView(this);
            imageView.SetScaleType(Android.Widget.ImageView.ScaleType.CenterInside);
            imageView.SetImageResource(resId);
            //imageView.setOnClickListener(new OnClickListener() {
            //    public void onClick(View v) {
            //        getSupportActionBar().show();
            //        hideActionBarDelayed(mHandler);
            //    }
            //});
            imageView.Click += delegate
            {
                SupportActionBar.Show();
                hideActionBarDelayed(mHandler);
            };

            SetContentView(imageView);
            this.Window.SetBackgroundDrawableResource(Android.Resource.Color.Black);
        }