当前位置: 首页>>代码示例>>C#>>正文


C# ViewGroup.AddView方法代码示例

本文整理汇总了C#中Android.Views.ViewGroup.AddView方法的典型用法代码示例。如果您正苦于以下问题:C# ViewGroup.AddView方法的具体用法?C# ViewGroup.AddView怎么用?C# ViewGroup.AddView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Views.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.AddView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddContentView

		protected void AddContentView (ViewGroup container, View quizContentView)
		{
			var layoutParams = new LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			container.AddView (questionView, layoutParams);
			container.AddView (quizContentView, layoutParams);
			AddView (container, layoutParams);
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:7,代码来源:AbsQuizView.cs

示例2: onCreate

        /// <summary>
        /// Construct the UI and start loading
        /// </summary>
		public void onCreate()
		{
			string startUrl = webSettings.GetString ("url");
			string title = webSettings.GetString ("title");
			mainLayout = new LinearLayout (this.context);
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 0.0F);
			mainLayout.LayoutParameters = lp;
			((LinearLayout)mainLayout).SetGravity (GravityFlags.CenterVertical);
			((LinearLayout)mainLayout).Orientation = Orientation.Vertical;

			webView = new WebView (this.context);
			WebSettings settings = webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.BuiltInZoomControls = true;
			settings.JavaScriptCanOpenWindowsAutomatically = true;

			webView.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 1.0F);

			webView.SetWebViewClient (new FHOAuthWebViewClient (this));
			webView.RequestFocusFromTouch ();
			webView.Visibility = ViewStates.Visible;

			LinearLayout barlayout = initHeaderBar (title);

			mainLayout.AddView (barlayout);
			mainLayout.SetBackgroundColor (Color.Transparent);
			mainLayout.SetBackgroundResource (0);
			mainLayout.AddView (this.webView);

			this.webView.LoadUrl (startUrl);

		}
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:35,代码来源:FHOAuthWebview.cs

示例3: InstantiateItem

		public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
		{
			_container = container;
			View view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.VacationInfoCreateDetail, container, false);

			var packageName =Application.Context.PackageName.ToString();
			view.Id =_container.Context.Resources.GetIdentifier ("view_"+position, "id" ,packageName);
			container.AddView (view);

			TextView ItemType = view.FindViewById<TextView> (Resource.Id.ItemType);
			Button ItemStartDateBtn = view.FindViewById<Button> (Resource.Id.ItemStartDateBtn);
			Button ItemEndDateBtn = view.FindViewById<Button> (Resource.Id.ItemEndDateBtn);
			Button ItemCreate = view.FindViewById<Button> (Resource.Id.ItemCreate);

			Button ItemPickImageFromGallery= view.FindViewById<Button> (Resource.Id.ItemPickImageFromGallery);
			Button ItemPickImageFromCamera= view.FindViewById<Button> (Resource.Id.ItemPickImageFromCamera);

			ItemStartDateBtn.Click += delegate { ShowDialog (0); };
			ItemEndDateBtn.Click += delegate { ShowDialog (1); };

			ItemStartDateBtn.Text = DateTime.Now.ToLocalTime ().ToString ("d");  
			ItemEndDateBtn.Text = DateTime.Now.ToLocalTime ().ToString ("d");

			ItemPickImageFromGallery.Click += onItemPickImageFromGalleryButtonClicked;
			ItemPickImageFromCamera.Click += onItemPickImageFromCameraButtonClicked;
			ItemCreate.Click += onItemCreateButtonClicked;

			int pos = position;
			ItemType.Text = items[pos];

			return view;
		}
开发者ID:dtimyr,项目名称:xamarin,代码行数:32,代码来源:VacationInfoCreatePagerAdapter.cs

示例4: AddSpinner

        public void AddSpinner(ViewGroup rootview,string loadingtext)
        {
            loading = true;
            if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){
                loadingcontainer = new RelativeLayout (nn_activity);
                loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                loadingcontainer.SetBackgroundColor (Color.White);

                var detailcontainer = new LinearLayout (nn_activity);

                detailcontainer.Orientation = Orientation.Vertical;
                RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent);
                param.AddRule (LayoutRules.CenterInParent);
                detailcontainer.LayoutParameters = param;

                LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                linearlayoutparm.Gravity = GravityFlags.CenterHorizontal;

                ProgressBar progressbar = new ProgressBar (nn_activity);
                progressbar.LayoutParameters = linearlayoutparm;

                TextView tectview = new TextView (nn_activity);
                tectview.LayoutParameters = linearlayoutparm;
                tectview.Text = loadingtext;
                tectview.Gravity = GravityFlags.CenterHorizontal;

                detailcontainer.AddView (progressbar);
                detailcontainer.AddView (tectview);

                loadingcontainer.AddView (detailcontainer);
                rootview.AddView (loadingcontainer);
            }
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:33,代码来源:Tap5050Fragment.cs

示例5: ShowBaiduAdIn

        private void ShowBaiduAdIn(ViewGroup adContainer)
        {
            BDBannerAd banner = new BDBannerAd(this, "Z03uBILZVtfZ0NxKfgc6yFDT", "QLD7hWvVAxEYCKNwDSCanemk");
            banner.SetAdSize(BDBannerAd.Size320x50);
            banner.AdvertisementViewDidShow += (a, b) => 
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewDidShow));
            };
            banner.AdvertisementDataDidLoadFailure += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementDataDidLoadFailure));
            };
            banner.AdvertisementDataDidLoadSuccess += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementDataDidLoadSuccess));
            };
            banner.AdvertisementViewDidClick += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewDidClick));
            };
            banner.AdvertisementViewWillStartNewIntent += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewWillStartNewIntent));
            };

            adContainer.AddView(banner);
        }
开发者ID:yufeih,项目名称:Xamarin.BaiduAds,代码行数:27,代码来源:MainActivity.cs

示例6: InstantiateItem

        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) {
            position %= this.Items.Count();

            var item = this.Items.ElementAt(position);
            var img = new ImageView(this.Ctx);
            this.SetSource(img, item);
            container.AddView(img, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            return img;
        }
开发者ID:gruan01,项目名称:Xamarin-Example,代码行数:9,代码来源:FlipViewAdapter.cs

示例7: InstantiateItem

            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item,container,false);
                container.AddView(view);
                

                
                return view;
            }
开发者ID:Poli143,项目名称:Login,代码行数:9,代码来源:SlidingTabsFragment.cs

示例8: InstantiateItem

        public override Object InstantiateItem(ViewGroup container, int position)
        {
            imageView = new ImageView(container.Context);
            imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
            imageLoader.DisplayImage(Urls[position], imageView);
            container.AddView(imageView);

            return imageView;
        }
开发者ID:Ontropix,项目名称:xatropix,代码行数:9,代码来源:SimpleCarouselAdapter.cs

示例9: InstantiateItem

			public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
			{
				View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item, container, false);
				container.AddView(view);

				TextView txtTitle = view.FindViewById<TextView>(Resource.Id.item_title);
				int pos = position + 1;
				txtTitle.Text = pos.ToString();

				return view;
			}
开发者ID:scrafty614,项目名称:XamarinStudio_Example,代码行数:11,代码来源:SlidingTabsFragment.cs

示例10: InstantiateItem

 public override Java.Lang.Object InstantiateItem(ViewGroup container, Int32 position)
 {
     var context = container.Context;
     var inflater = LayoutInflater.From(context);
     var view = inflater.Inflate(Resource.Layout.ItemFont, container, false);
     var recyclerView = (RecyclerView)view.FindViewById(Resource.Id.recyclerView);
     var nbColumns = Utils.AndroidUtils.GetScreenSize((Activity)context).Width / context.Resources.GetDimensionPixelSize(Resource.Dimension.item_width);
     recyclerView.SetLayoutManager(new GridLayoutManager(context, nbColumns));
     recyclerView.SetAdapter(new IconAdapter(_fonts[position].Characters.ToArray()));
     container.AddView(view);
     return view;
 }
开发者ID:MuffPotter,项目名称:Xamarin.Plugins,代码行数:12,代码来源:FontIconsViewPagerAdapter.cs

示例11: InstantiateItem

        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) {
            position %= this.Items.Count();

            var item = this.Items.ElementAt(position);

            if (item.Parent != null) {
                var p = item.Parent as ViewGroup;
                if (p != null)
                    p.RemoveView(item);
            }

            container.AddView(item, 200, 200);
            return item;
        }
开发者ID:zhangcj,项目名称:Xamarin.Forms.Lagou,代码行数:14,代码来源:FlipViewAdapter.cs

示例12: InstantiateItem

		/// <summary>
		/// 初始item位置界面
		/// </summary>
		/// <returns>The item.</returns>
		/// <param name="container">Container.</param>
		/// <param name="position">Position.</param>
		public override Java.Lang.Object InstantiateItem (ViewGroup container, int position)
		{

			container.AddView(views[position]);
			if (position == views.Count - 1) {
				var btn_start_use = container.FindViewById<Button> (Resource.Id.btn_start_use);
				btn_start_use.SetOnClickListener (this);
			} else {
				var btn_skip = container.FindViewById<Button> (Resource.Id.btn_skip);
				btn_skip.SetOnClickListener (this);
			}

			return views[position];
		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:20,代码来源:GuiderViewPageAdapter.cs

示例13: ShadowWrapper

		public ShadowWrapper (Android.Content.Context context, ViewGroup realContent) : base (context)
		{
			Content = realContent;
			OriginalParent = realContent.Parent as ViewGroup;
			OriginalParent.RemoveView (realContent);
			this.SetMinimumHeight (realContent.Height);
			this.SetMinimumWidth (realContent.Width);
			this.AddView (realContent, new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent,
				LinearLayout.LayoutParams.FillParent));
			OriginalParent.AddView (this, new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent,
				LinearLayout.LayoutParams.FillParent));
			this.SetBackgroundColor (Android.Graphics.Color.Red);

		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:14,代码来源:ViewMaskExtensionProvider.cs

示例14: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            InputMethodManager imm = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);
            if (imm.IsActive)
            {
                View focusView = Activity.CurrentFocus;
                if (focusView != null)
                {
                    imm.HideSoftInputFromWindow(focusView.WindowToken, HideSoftInputFlags.None);
                }
            }
            mView = CreateView(inflater, container, savedInstanceState);
            mGroup = (ViewGroup)Activity.Window.DecorView;

            mGroup.AddView(mView);
            mBg.StartAnimation(CreateAlphaInAnimation());
            mPanel.StartAnimation(CreateTranslationInAnimation());
            return base.OnCreateView(inflater, container, savedInstanceState);
        }
开发者ID:huguodong,项目名称:ActionSheetCSharp,代码行数:19,代码来源:ActionSheet.cs

示例15: InstantiateItem

 public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
 {
     container.AddView(views[position], 0);
     return views[position];
 }
开发者ID:hwqdt,项目名称:Demos,代码行数:5,代码来源:ViewPagerAdapter.cs


注:本文中的Android.Views.ViewGroup.AddView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。