public override void HandleStyledAttributes(Android.Content.Res.TypedArray a)
        {
            base.HandleStyledAttributes(a);
            _rootContainer             = new LinearLayout(Context);
            _rootContainer.Orientation = Orientation.Vertical;
            _headerContainer           = new FrameLayout(Context);

            if (_zoomView != null)
            {
                _headerContainer.AddView(_zoomView);
            }
            if (_headerView != null)
            {
                _headerContainer.AddView(_headerView);
            }
            int contentViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollContentView, 0);

            if (contentViewResId > 0)
            {
                LayoutInflater mLayoutInflater = LayoutInflater.From(Context);
                _contentView = mLayoutInflater.Inflate(contentViewResId, null, false);
            }

            _rootContainer.AddView(_headerContainer);
            if (_contentView != null)
            {
                _rootContainer.AddView(_contentView);
            }

            _rootContainer.SetClipChildren(false);
            _headerContainer.SetClipChildren(false);

            _rootView.AddView(_rootContainer);
        }
Пример #2
0
 void InitializeChildGrid()
 {
     if (childGrid == null)
     {
         childGrid = new FrameLayout(sampleContext);
         childGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
         childGrid.SetClipChildren(false);
     }
 }
        void Init(IAttributeSet attrs)
        {
            _headerContainer  = new FrameLayout(Context);
            _zoomContainer    = new FrameLayout(Context);
            _contentContainer = new FrameLayout(Context);

            _rootContainer             = new LinearLayout(Context);
            _rootContainer.Orientation = Android.Widget.Orientation.Vertical;

            if (attrs != null)
            {
                LayoutInflater layoutInflater = LayoutInflater.From(Context);
                //初始化状态View
                TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.PullToZoomScrollView);

                int zoomViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollZoomView, 0);
                if (zoomViewResId > 0)
                {
                    _zoomView = layoutInflater.Inflate(zoomViewResId, null, false);
                    _zoomContainer.AddView(_zoomView);
                    _headerContainer.AddView(_zoomContainer);
                }

                int headViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollHeadView, 0);
                if (headViewResId > 0)
                {
                    _headView = layoutInflater.Inflate(headViewResId, null, false);
                    _headerContainer.AddView(_headView);
                }
                int contentViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollContentView, 0);
                if (contentViewResId > 0)
                {
                    _contentView = layoutInflater.Inflate(contentViewResId, null, false);
                    _contentContainer.AddView(_contentView);
                }

                a.Recycle();
            }

            DisplayMetrics localDisplayMetrics = new DisplayMetrics();

            ((Activity)Context).WindowManager.DefaultDisplay.GetMetrics(localDisplayMetrics);
            _screenHeight    = localDisplayMetrics.HeightPixels;
            _zoomWidth       = localDisplayMetrics.WidthPixels;
            _scalingRunnable = new ScalingRunnable(this);

            _rootContainer.AddView(_headerContainer);
            _rootContainer.AddView(_contentContainer);

            _rootContainer.SetClipChildren(false);
            _headerContainer.SetClipChildren(false);

            AddView(_rootContainer);
        }
Пример #4
0
        void AddGridView()
        {
            InitializeChildGrid();
            mainGrid = new FrameLayout(sampleContext);
            mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                   ViewGroup.LayoutParams.MatchParent);
            mainGrid.AddView(childGrid);
            maps = new SfMaps(sampleContext);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            ImageryLayer layer = new ImageryLayer();

            maps.Layers.Add(layer);
            mainGrid.AddView(maps);
            mainGrid.SetClipChildren(false);
            LinearLayout linear = new LinearLayout(sampleContext);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(sampleContext);

            textView1.Text = "©";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(sampleContext);

            textView2.Text = "OpenStreetMap contributors.";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            mainGrid.AddView(linear);
        }
Пример #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ViewGroup view = (ViewGroup)inflater.Inflate(Resource.Layout.game_fragment, container, false);

            view.SetClipChildren(false);
            ((ViewGroup)view.FindViewById(Resource.Id.game_board)).SetClipChildren(false);
            mTime      = (TextView)view.FindViewById(Resource.Id.time_bar_text);
            mTimeImage = (ImageView)view.FindViewById(Resource.Id.time_bar_image);
            FontLoader.SetTypeface(new TextView[] { mTime }, FontLoader.Font.GROBOLD);
            mBoardView = BoardView.fromXml(Android.App.Application.Context, view);
            FrameLayout frameLayout = (FrameLayout)view.FindViewById(Resource.Id.game_container);

            frameLayout.AddView(mBoardView);
            frameLayout.SetClipChildren(false);

            // build board
            BuildBoard();
            Shared.EventBus.listen(nameof(FlipDownCardsEvent), this);
            Shared.EventBus.listen(nameof(HidePairCardsEvent), this);
            Shared.EventBus.listen(nameof(GameWonEvent), this);

            return(view);
        }
        public PullToZoomScrollViewEx(Context context, IAttributeSet attrs) : base(context, attrs)
        {
            Android.Content.Res.TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.PullToZoomView);
            _rootContainer             = new LinearLayout(Context);
            _rootContainer.Orientation = Orientation.Vertical;
            _headerContainer           = new FrameLayout(Context);

            if (_zoomView != null)
            {
                _headerContainer.AddView(_zoomView);
            }
            if (_headerView != null)
            {
                _headerContainer.AddView(_headerView);
            }
            int contentViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollContentView, 0);

            if (contentViewResId > 0)
            {
                LayoutInflater mLayoutInflater = LayoutInflater.From(Context);
                _contentView = mLayoutInflater.Inflate(contentViewResId, null, false);
            }

            _rootContainer.AddView(_headerContainer);
            if (_contentView != null)
            {
                _rootContainer.AddView(_contentView);
            }

            _rootContainer.SetClipChildren(false);
            _headerContainer.SetClipChildren(false);

            _rootView.AddView(_rootContainer);

            _scalingRunnable = new ScalingRunnable(this);
            ((InternalScrollView)_rootView).SetOnScrollViewChangedListener(this);
        }
Пример #7
0
        private void Layout_LayoutChange1(object sender, View.LayoutChangeEventArgs e)
        {
            var layout = sender as LinearLayout;

            if (childGrid != null && childGrid.ChildCount > 0 &&
                previousWidth == layout.Width && previousHeight == layout.Height)
            {
                return;
            }
            if (layout != null)
            {
                InitializeChildGrid();
                if (layout.Height > 0)
                {
                    double row = layout.Height / 512;
                    if (Math.Ceiling(row) <= 0)
                    {
                        row = 1;
                    }
                    else
                    {
                        row = Math.Ceiling(row);
                    }
                    rowCount       = (int)row + 1;
                    previousHeight = layout.Height;
                }
                if (layout.Width > 0)
                {
                    double column = layout.Width / 512;
                    if (Math.Ceiling(column) <= 0)
                    {
                        column = 1;
                    }
                    else
                    {
                        column = Math.Ceiling(column);
                    }
                    columnCount   = (int)column + 1;
                    previousWidth = layout.Width;
                }
                for (int i = 0; i < rowCount; i++)
                {
                    for (int j = 0; j < columnCount; j++)
                    {
                        ImageView image = new ImageView(sampleContext);
                        image.SetImageResource(Resource.Drawable.grid);
                        image.SetMinimumHeight((int)(512 * density));
                        image.SetMinimumWidth((int)(512 * density));
                        image.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                            ViewGroup.LayoutParams.MatchParent);
                        image.LayoutParameters.Height = (int)(512 * density);
                        image.LayoutParameters.Width  = (int)(512 * density);
                        image.SetPadding(0, 0, 0, 0);
                        image.SetX(i * (512 * density));
                        image.SetY(j * (512 * density));
                        childGrid.AddView(image);
                    }
                }
                childGrid.SetClipChildren(false);
            }
        }
Пример #8
0
        void AddGridView()
        {
            InitializeChildGrid();
            mainGrid = new FrameLayout(sampleContext);
            mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                   ViewGroup.LayoutParams.MatchParent);
            mainGrid.AddView(childGrid);
            maps                  = new SfMaps(sampleContext);
            maps.ZoomLevel        = 4;
            maps.MinZoom          = 4;
            maps.MaxZoom          = 10;
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            layer                 = new ImageryLayer();

            layer.GeoCoordinates = new PointF(27.1751f, 78.0421f);

            PopulationMarker marker1 = new PopulationMarker(sampleContext);

            marker1.Latitude  = 20.6843f;
            marker1.Longitude = -88.5678f;
            layer.Markers.Add(marker1);

            PopulationMarker marker2 = new PopulationMarker(sampleContext);

            marker2.Latitude  = -13.1631f;
            marker2.Longitude = -72.5450f;
            layer.Markers.Add(marker2);

            PopulationMarker marker3 = new PopulationMarker(sampleContext);

            marker3.Latitude  = -22.9519f;
            marker3.Longitude = -43.2106f;
            layer.Markers.Add(marker3);

            PopulationMarker marker4 = new PopulationMarker(sampleContext);

            marker4.Latitude  = 41.8902;
            marker4.Longitude = 12.4922;
            layer.Markers.Add(marker4);

            PopulationMarker marker5 = new PopulationMarker(sampleContext);

            marker5.Latitude  = 30.3285;
            marker5.Longitude = 35.4444;
            layer.Markers.Add(marker5);

            PopulationMarker marker6 = new PopulationMarker(sampleContext);

            marker6.Latitude  = 27.1751;
            marker6.Longitude = 78.0421;
            layer.Markers.Add(marker6);

            PopulationMarker marker7 = new PopulationMarker(sampleContext);

            marker7.Latitude  = 40.4319;
            marker7.Longitude = 116.5704;
            layer.Markers.Add(marker7);

            maps.Adapter = new MarkerAdapter(sampleContext);

            maps.Layers.Add(layer);
            mainGrid.AddView(maps);
            mainGrid.SetClipChildren(false);

            List <int> arrayList = new List <int>();

            arrayList.Add(Resource.Drawable.Mexico);
            arrayList.Add(Resource.Drawable.Peru);
            arrayList.Add(Resource.Drawable.Christ);
            arrayList.Add(Resource.Drawable.Colosseum);
            arrayList.Add(Resource.Drawable.Petra);
            arrayList.Add(Resource.Drawable.TajMahal);
            arrayList.Add(Resource.Drawable.China_wall);

            List <string> descriptionList = new List <string>();

            descriptionList.Add("Mayan ruins on Mexico's Yucatan Peninsula. It was one of the largest Maya cities, thriving from around A.D. 600 to 1200.");
            descriptionList.Add("An inca citadel built in the mid-1400s. It was not widely known until the early 20th century.");
            descriptionList.Add("An enormous statue of Jesus Christ with open arms. A symbol of Christianity across the world, the statue has also become a cultural icon of both Rio de Janeiro and Brazil.");
            descriptionList.Add("Built between A.D. 70 and 80. It is one of the most popular touristattractions in Europe.");
            descriptionList.Add("It is a historic and archaeological city in southern Jordan. Petra lies around Jabal Al-Madbah in a basin surrounded by mountains which form the eastern flank of the Arabah valley that runs from the Dead Sea to the Gulf of Aqaba.");
            descriptionList.Add("It is an ivory-white marble mausoleum on the southern bank of the river Yamuna in the Indian city of Agra.");
            descriptionList.Add("The Great Wall of China is a series of fortifications that were built across the historical northern borders of ancient Chinese states and Imperial China as protection against various nomadic groups from the Eurasian Steppe.");

            List <string> headerList = new List <string>();

            headerList.Add("Chichen Itza, Mexico");
            headerList.Add("Machu Picchu, Peru");
            headerList.Add("Chirst the Redeemer, Brazil");
            headerList.Add("Colosseum, Rome");
            headerList.Add("Petra, Jordan");
            headerList.Add("Taj Mahal, India");
            headerList.Add("Great wall of China, China");

            DisplayMetrics displayMetrics = sampleContext.Resources.DisplayMetrics;
            float          screenWidth    = displayMetrics.WidthPixels;
            float          screenHeight   = displayMetrics.HeightPixels;
            var            density        = displayMetrics.Density;

            LinearLayout layout = new LinearLayout(sampleContext);

            layout.Orientation = Orientation.Horizontal;
            layout.SetPadding(0, 0, 0, 10);
            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            layout.SetVerticalGravity(GravityFlags.Bottom);

            var itemWidth = screenWidth * 0.7;

            SfCarousel carousel = new SfCarousel(sampleContext);

            carousel.RotationAngle      = 0;
            carousel.ItemWidth          = (int)itemWidth;
            carousel.ItemHeight         = (int)(110 * sampleContext.Resources.DisplayMetrics.Density);
            carousel.LayoutParameters   = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, carousel.ItemHeight);
            carousel.SelectedIndex      = 5;
            carousel.SelectedItemOffset = (int)(carousel.ItemWidth / 2) - (int)(carouselGap * density);

            List <SfCarouselItem> dataSource = new List <SfCarouselItem>();

            for (int i = 0; i <= 6; i++)
            {
                LinearLayout linearLayout = new LinearLayout(sampleContext);
                linearLayout.SetBackgroundColor(Color.White);
                linearLayout.Orientation = Orientation.Horizontal;
                linearLayout.SetBackgroundResource((Resource.Drawable.carousel_corner_radius));
                linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)itemWidth, (int)carousel.ItemHeight);

                var width = (int)(0.6f * itemWidth);

                LinearLayout layout1 = new LinearLayout(sampleContext);
                layout1.Orientation      = Orientation.Vertical;
                layout1.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)width, (int)carousel.ItemHeight);
                layout1.SetPadding(15, 15, 15, 15);

                TextView textView = new TextView(sampleContext);
                textView.Text = headerList[i];

                textView.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                textView.TextAlignment    = TextAlignment.TextStart;
                textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent);
                layout1.AddView(textView);

                textView      = new TextView(sampleContext);
                textView.Text = descriptionList[i];
                textView.SetMaxLines(3);
                textView.Ellipsize     = Android.Text.TextUtils.TruncateAt.End;
                textView.TextAlignment = TextAlignment.TextStart;
                textView.SetPadding(0, 10, 0, 0);
                textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent);
                layout1.AddView(textView);
                linearLayout.AddView(layout1);

                SfCarouselItem sfCarouselItem = new SfCarouselItem(sampleContext);

                width = (int)(0.4f * itemWidth);

                LinearLayout layout2 = new LinearLayout(sampleContext);
                layout2.SetPadding(10, 15, 15, 15);

                layout2.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width, carousel.ItemHeight);
                ImageView imageView = new ImageView(sampleContext);
                imageView.SetBackgroundResource((Resource.Drawable.carousel_corner_radius));

                imageView.SetImageResource(arrayList[i]);
                imageView.SetScaleType(ImageView.ScaleType.FitXy);
                imageView.ClipToOutline = true;

                layout2.AddView(imageView);

                linearLayout.AddView(layout2);
                sfCarouselItem.ContentView = linearLayout;
                dataSource.Add(sfCarouselItem);
            }

            carousel.DataSource        = dataSource;
            carousel.SelectionChanged += Carousel_SelectionChanged;
            layout.AddView(carousel);
            mainGrid.AddView(layout);

            LinearLayout linear = new LinearLayout(sampleContext);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(sampleContext);

            textView1.Text = "©";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(sampleContext);

            textView2.Text = "OpenStreetMap contributors.";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            mainGrid.AddView(linear);
        }
		void Init(IAttributeSet attrs) {
			_headerContainer = new FrameLayout(Context);
			_zoomContainer = new FrameLayout(Context);
			_contentContainer = new FrameLayout(Context);

			_rootContainer = new LinearLayout(Context);
			_rootContainer.Orientation = Android.Widget.Orientation.Vertical;

			if (attrs != null) {
				LayoutInflater layoutInflater = LayoutInflater.From(Context);
				//初始化状态View
				TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.PullToZoomScrollView);

				int zoomViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollZoomView, 0);
				if (zoomViewResId > 0) {
					_zoomView = layoutInflater.Inflate(zoomViewResId, null, false);
					_zoomContainer.AddView(_zoomView);
					_headerContainer.AddView(_zoomContainer);
				}

				int headViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollHeadView, 0);
				if (headViewResId > 0) {
					_headView = layoutInflater.Inflate(headViewResId, null, false);
					_headerContainer.AddView(_headView);
				}
				int contentViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollContentView, 0);
				if (contentViewResId > 0) {
					_contentView = layoutInflater.Inflate(contentViewResId, null, false);
					_contentContainer.AddView(_contentView);
				}

				a.Recycle();
			}

			DisplayMetrics localDisplayMetrics = new DisplayMetrics();
			((Activity) Context).WindowManager.DefaultDisplay.GetMetrics(localDisplayMetrics);
			_screenHeight = localDisplayMetrics.HeightPixels;
			_zoomWidth = localDisplayMetrics.WidthPixels;
			_scalingRunnable = new ScalingRunnable(this);

			_rootContainer.AddView(_headerContainer);
			_rootContainer.AddView(_contentContainer);

			_rootContainer.SetClipChildren(false);
			_headerContainer.SetClipChildren(false);

			AddView(_rootContainer);
		}
Пример #10
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            handler     = new Handler();
            frameLayout = new FrameLayout(context);
            frameLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                      ViewGroup.LayoutParams.MatchParent);

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            sampleContext = context;

            LinearLayout layout = new LinearLayout(context);

            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            layout.Orientation = Orientation.Horizontal;
            layout.SetHorizontalGravity(GravityFlags.Center);
            TextView textView = new TextView(context);

            textView.TextSize = 16;
            textView.SetPadding(2, 2, 2, 2);
            textView.SetHeight(90);
            textView.Gravity = Android.Views.GravityFlags.Top;
            textView.Text    = "Top 40 countries population";
            layout.AddView(textView);
            frameLayout.AddView(layout);

            maps = new SfMaps(context);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            ShapeFileLayer layer = new ShapeFileLayer();

            layer.ShowItems         = true;
            layer.Uri               = "world1.shp";
            layer.DataSource        = GetDataSource();
            layer.ShapeIdPath       = "Country";
            layer.ShowItems         = true;
            layer.ShapeIdTableField = "NAME";

            layer.ShapeSettings           = new ShapeSetting();
            layer.ShapeSettings.ShapeFill = Color.LightGray;

            BubbleMarkerSetting marker = new BubbleMarkerSetting();

            marker.ValuePath      = "Percent";
            marker.ColorValuePath = "Percent";

            RangeColorMapping rangeColorMapping = new RangeColorMapping();

            rangeColorMapping.Color       = Color.ParseColor("#2E769F");
            rangeColorMapping.From        = 4;
            rangeColorMapping.To          = 20;
            rangeColorMapping.LegendLabel = "Above 4%";
            marker.ColorMapping.Add(rangeColorMapping);

            RangeColorMapping rangeColorMapping1 = new RangeColorMapping();

            rangeColorMapping1.Color       = Color.ParseColor("#D84444");
            rangeColorMapping1.From        = 2;
            rangeColorMapping1.To          = 4;
            rangeColorMapping1.LegendLabel = "4% - 2%";
            marker.ColorMapping.Add(rangeColorMapping1);

            RangeColorMapping rangeColorMapping2 = new RangeColorMapping();

            rangeColorMapping2.Color       = Color.ParseColor("#816F28");
            rangeColorMapping2.From        = 1;
            rangeColorMapping2.To          = 2;
            rangeColorMapping2.LegendLabel = "2% - 1%";
            marker.ColorMapping.Add(rangeColorMapping2);

            RangeColorMapping rangeColorMapping3 = new RangeColorMapping();

            rangeColorMapping3.Color       = Color.ParseColor("#7F38A0");
            rangeColorMapping3.From        = 0;
            rangeColorMapping3.To          = 1;
            rangeColorMapping3.LegendLabel = "Below 1%";
            marker.ColorMapping.Add(rangeColorMapping3);

            layer.BubbleMarkerSetting = marker;

            LegendSetting legendSetting = new LegendSetting();

            legendSetting.ShowLegend     = true;
            legendSetting.LegendType     = LegendType.Bubbles;
            legendSetting.LegendPosition = new Point(50, 10);
            legendSetting.ItemMargin     = 15;
            layer.LegendSetting          = legendSetting;

            maps.Layers.Add(layer);
            frameLayout.AddView(maps);

            frameLayout.SetClipChildren(false);

            LinearLayout linear = new LinearLayout(context);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(context);

            textView1.Text = "Source:";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(context);

            textView2.Text = "en.wikipedia.org";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            frameLayout.AddView(linear);

            SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context);

            sfBusyIndicator.IsBusy        = true;
            sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
            sfBusyIndicator.ViewBoxWidth  = 50;
            sfBusyIndicator.ViewBoxHeight = 50;
            sfBusyIndicator.TextColor     = Color.ParseColor("#779772");
            linearLayout.AddView(sfBusyIndicator);
            Java.Lang.Runnable run = new Java.Lang.Runnable(() =>
            {
                linearLayout.RemoveView(sfBusyIndicator);
                linearLayout.AddView(frameLayout);
            });
            handler.PostDelayed(run, 100);

            return(linearLayout);
        }
Пример #11
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            handler = new Handler();

            frameLayout = new FrameLayout(context);
            frameLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                      ViewGroup.LayoutParams.MatchParent);

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            sampleContext = context;

            LinearLayout layout = new LinearLayout(context);

            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            layout.Orientation = Orientation.Horizontal;
            layout.SetHorizontalGravity(GravityFlags.Center);

            TextView textView = new TextView(context);

            textView.TextSize = 16;
            textView.SetPadding(2, 2, 2, 2);
            textView.SetHeight(90);
            textView.Gravity = Android.Views.GravityFlags.Top;
            textView.Text    = "Samsung Semiconductor office location in USA";
            layout.AddView(textView);
            frameLayout.AddView(layout);

            maps = new SfMaps(context);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            ShapeFileLayer layer = new ShapeFileLayer();

            layer.ShowItems         = true;
            layer.Uri               = "usa_state.shp";
            layer.DataSource        = GetDataSource();
            layer.ShapeIdPath       = "Name";
            layer.ShapeIdTableField = "STATE_NAME";
            layer.DataLabelSettings = new DataLabelSetting()
            {
                TextColor = Color.Black
            };
            layer.ShapeSettings = new ShapeSetting();
            layer.ShapeSettings.ShapeValuePath      = "Type";
            layer.ShapeSettings.ShapeFill           = Color.ParseColor("#E5E5E5");
            layer.ShapeSettings.ShapeStroke         = Color.ParseColor("#D0D0D0");
            layer.ShapeSettings.ShapeStrokeThickess = 2;

            layer.DataLabelSettings.IntersectionAction = IntersectAction.Trim;

            SubShapeFileLayer subLayer = new SubShapeFileLayer();

            subLayer.Uri = "Texas.shp";
            subLayer.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker = new MapMarker();

            mapMarker.Latitude  = 30.267153;
            mapMarker.Longitude = -97.7430608;
            subLayer.Markers.Add(mapMarker);

            MarkerSetting markerSetting = new MarkerSetting();

            markerSetting.MarkerIconColor = Color.DarkGreen;
            markerSetting.IconSize        = 7;
            subLayer.MarkerSetting        = markerSetting;

            SubShapeFileLayer subLayer1 = new SubShapeFileLayer();

            subLayer1.Uri = "California.shp";
            subLayer1.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer1.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer1.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker1 = new MapMarker();

            mapMarker1.Latitude  = 37.3382082;
            mapMarker1.Longitude = -121.8863286;
            subLayer1.Markers.Add(mapMarker1);

            MarkerSetting markerSetting1 = new MarkerSetting();

            markerSetting1.MarkerIconColor = Color.DarkGreen;
            markerSetting1.IconSize        = 7;
            subLayer1.MarkerSetting        = markerSetting1;

            layer.SubShapeFileLayers.Add(subLayer);
            layer.SubShapeFileLayers.Add(subLayer1);

            maps.Layers.Add(layer);
            frameLayout.AddView(maps);
            frameLayout.SetClipChildren(false);

            LinearLayout linear = new LinearLayout(context);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(context);

            textView1.Text = "Source:";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(context);

            textView2.Text = "www.samsung.com";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            frameLayout.AddView(linear);

            SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context);

            sfBusyIndicator.IsBusy        = true;
            sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
            sfBusyIndicator.ViewBoxWidth  = 50;
            sfBusyIndicator.ViewBoxHeight = 50;
            sfBusyIndicator.TextColor     = Color.ParseColor("#779772");
            linearLayout.AddView(sfBusyIndicator);
            Java.Lang.Runnable run = new Java.Lang.Runnable(() =>
            {
                linearLayout.RemoveView(sfBusyIndicator);
                linearLayout.AddView(frameLayout);
            });
            handler.PostDelayed(run, 100);

            return(linearLayout);
        }