本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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];
}
示例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);
}
示例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);
}
示例15: InstantiateItem
public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
{
container.AddView(views[position], 0);
return views[position];
}