本文整理汇总了C#中LinearLayout.AddView方法的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.AddView方法的具体用法?C# LinearLayout.AddView怎么用?C# LinearLayout.AddView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.AddView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var layout = new LinearLayout(this) {
Orientation = Orientation.Vertical
};
this.AddContentView(layout, new ViewGroup.LayoutParams(-1, -1));
this.T1 = new TextView(this);
this.T2 = new TextView(this) {
Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
layout.AddView(this.T1);
layout.AddView(this.T2);
var btn = new Button(this) {
Text = "Search"
};
btn.Click += Btn_Click;
layout.AddView(btn);
this.HandleIntent(this.Intent);
}
示例2: GetPropertyWindowLayout
public override View GetPropertyWindowLayout (Android.Content.Context context)
{
LinearLayout linear = new LinearLayout (context);
linear.Orientation = Orientation.Vertical;
allowsorting = new CheckBox (context);
allowtristatesorting = new CheckBox (context);
allowsortingforSupplierID = new CheckBox (context);
allowsortingforProductID = new CheckBox (context);
allowsorting.Text = "Allow Sorting";
allowtristatesorting.Text = "Allow TriState Sorting";
allowsortingforSupplierID.Text = "Allow Sorting For SupplierID";
allowsortingforProductID.Text = "Allow Sorting For ProductID";
allowsorting.Checked = true;
allowtristatesorting.Checked = true;
allowsortingforSupplierID.Checked = true;
allowsortingforProductID.Checked = true;
allowsorting.CheckedChange += OnAllowSortingChanged;
allowtristatesorting.CheckedChange += OnAllowTriStateSortingChanged;
allowsortingforProductID.CheckedChange += OnSortingForProductIDChanged;
allowsortingforSupplierID.CheckedChange += OnSortingForSupplierIDChanged;
linear.AddView (allowsorting);
linear.AddView (allowtristatesorting);
linear.AddView (allowsortingforSupplierID);
linear.AddView (allowsortingforProductID);
return linear;
}
示例3: OnCreate
//this comment should only be available in dev
//this comment should only be available in release branch
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
var surfaceOrientation = WindowManager.DefaultDisplay.Rotation;
mainLayout = viewResource.LinLayout (this);
if(surfaceOrientation == SurfaceOrientation.Rotation0 || surfaceOrientation == SurfaceOrientation.Rotation180)
{
mainLayout.Orientation = Orientation.Vertical;
}
else if (surfaceOrientation == SurfaceOrientation.Rotation90 || surfaceOrientation == SurfaceOrientation.Rotation270)
{
mainLayout.Orientation = Orientation.Horizontal;
}
topLayout = viewResource.LinLayout (this);
topLayout.Id = 1;
topLayout.WeightSum = 1;
//topLayout.SetMinimumHeight(mainLayout.Height * .25);
bottomLayout = viewResource.LinLayout (this);
bottomLayout.Id = 2;
bottomLayout.WeightSum = 1;
//bottomLayout.SetMinimumHeight( mainLayout.Height * .75);
LoadFragments ();
mainLayout.AddView (topLayout);
mainLayout.AddView (bottomLayout);
SetContentView (mainLayout);
Console.WriteLine(mainLayout.ToString ());
}
示例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: GetSampleContent
public override Android.Views.View GetSampleContent (Android.Content.Context context)
{
LinearLayout layout= new LinearLayout(context);
layout.Orientation = Orientation.Vertical;
TextView textView= new TextView(context);
textView.TextSize = 16;
textView.SetPadding(10,20,0,0);
textView.SetHeight(70);
textView.Text ="Top Population Countries With Bubbles";
layout.AddView(textView);
textView.Gravity = Android.Views.GravityFlags.Top;
maps = new SfMaps (context);
ShapeFileLayer layer = new ShapeFileLayer ();
layer.ShowItems = true;
layer.Uri ="world1.shp";
layer.DataSource = GetDataSource();
layer.ShapeIdPath = "Country";
layer.ShapeIdTableField = "NAME";
layer.ShapeSettings = new ShapeSetting ();
layer.ShapeSettings.ShapeValuePath= "ShortName";
layer.ShapeSettings.ShapeFill = Color.ParseColor ("#A9D9F7");
BubbleMarkerSetting marker = new BubbleMarkerSetting ()
{ FillColor = Color.ParseColor ("#ffa500"), MinSize=15,MaxSize=25, ValuePath="Population" };
layer.BubbleMarkerSetting = marker;
maps.Layers.Add (layer);
layout.AddView (maps);
return layout;
}
示例6: Initialize
void Initialize ()
{
this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-1);
this.SetGravity(GravityFlags.CenterHorizontal);
mainLinearLayout = new LinearLayout (context);
mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
mainLinearLayout.Orientation = Orientation.Vertical;
imBack = new ImageView (context);
txtDescription = new TextView (context);
txtTitle = new TextView (context);
txtTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
txtDescription.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
txtTitle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
txtDescription.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
int padW = Configuration.getWidth(30);
int padH = Configuration.getHeight (0);
this.SetPadding (padW,padH,padW,padH);
mainLinearLayout.AddView (txtTitle);
mainLinearLayout.AddView (imBack);
mainLinearLayout.AddView (txtDescription);
this.AddView (mainLinearLayout);
//this.AddView (background);
}
示例7: ImageZoom
//-----------clicking on images -> image on fullscreen---------//
protected void ImageZoom(ImageView imageView, string Tag, LinearLayout fullScreen, LinearLayout downScreen, Button takeIt)
{
imageView.Click += ((object sender, System.EventArgs e) => {
Log.Info(Tag, "isImageFitToScreen: " + isImageFitToScreen.ToString());
if (isImageFitToScreen) {
downScreen.RemoveView(imageView);
imageView.SetMaxHeight (1500);
imageView.SetMaxWidth (1500);
fullScreen.AddView(imageView);
fullScreen.AddView(takeIt);
Log.Info(Tag, "maximize");
canBeSelected = true;
isImageFitToScreen = false;
} else {
fullScreen.RemoveView(takeIt);
fullScreen.RemoveView(imageView);
imageView.SetMaxHeight (450);
imageView.SetMaxWidth (450);
downScreen.AddView(imageView);
Log.Info(Tag, "minimize");
canBeSelected = false;
isImageFitToScreen = true;
}
});
}
示例8: Login
public override void Login(LoginConfig config)
{
var context = Utils.GetActivityContext();
var txtUser = new EditText(context) {
Hint = config.LoginPlaceholder,
Text = config.LoginValue ?? String.Empty
};
var txtPass = new EditText(context) {
Hint = config.PasswordPlaceholder,
TransformationMethod = PasswordTransformationMethod.Instance
};
var layout = new LinearLayout(context) {
Orientation = Orientation.Vertical
};
layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent);
layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent);
Utils.RequestMainThread(() =>
new AlertDialog
.Builder(Utils.GetActivityContext())
.SetTitle(config.Title)
.SetMessage(config.Message)
.SetView(layout)
.SetPositiveButton(config.OkText, (o, e) =>
config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true))
)
.SetNegativeButton(config.CancelText, (o, e) =>
config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false))
)
.Show()
);
}
示例9: Initialize
void Initialize ()
{
this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
this.SetGravity(GravityFlags.Center);
image = new RelativeLayout(context);
txtDescription = new TextView (context);
txtTitle = new TextView (context);
background = new LinearLayout (context);
image.SetGravity (GravityFlags.Center);
background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
background.Orientation = Orientation.Vertical;
background.SetBackgroundColor (Color.ParseColor ("#50000000"));
image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
txtDescription.SetTextColor(Color.ParseColor("#ffffff"));
txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
background.AddView (txtTitle);
background.AddView (txtDescription);
image.AddView (background);
this.AddView (image);
//this.AddView (background);
}
示例10: OnDraw
protected override void OnDraw(Canvas canvas)
{
base.OnDraw(canvas);
var actionBar = ((Activity)Context).ActionBar;
LinearLayout layout = new LinearLayout(Context);
layout.Orientation = Orientation.Horizontal;
layout.WeightSum = 100;
TextView title = new TextView(Context);
title.Text = actionBar.Title;
title.TextSize = 18;
Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "BTrafcBd.ttf");
title.Typeface = font;
LayoutParams textlp = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
ImageView logo = new ImageView(Context);
logo.SetImageResource(Resource.Drawable.Logo);
LayoutParams imglp = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
layout.AddView(title, textlp);
layout.AddView(logo, imglp);
actionBar.SetCustomView(layout, new ActionBar.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent));
actionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom, ActionBarDisplayOptions.ShowCustom);
}
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
//return base.OnCreateView (inflater, container, savedInstanceState);
linLayout = viewResource.LinLayout (this.Activity);
//linLayout.Id = 1;
txtViewTitle = viewResource.TextViewTitle (this.Activity);
txtViewTitle.SetPadding (10, 10, 10, 10);
button = viewResource.BtnOne (this.Activity);
button.Click += OnButtonClick;
button.Text = "Click me!";
buttonTwo = viewResource.BtnTwo (this.Activity);
txtViewTwo = viewResource.TextViewOne(this.Activity);
txtViewTwo.Text = "Click the button!";
subLayout = viewResource.SubLinLayout (this.Activity);
subLayout.AddView (txtViewTwo);
subLayout.AddView (button);
subLayout.AddView (buttonTwo);
linLayout.AddView (subLayout);
linLayout.SetBackgroundColor (Android.Graphics.Color.BlueViolet);
return linLayout;
}
示例12: CreateLayout
private void CreateLayout()
{
// Create a new vertical layout for the app
var layout = new LinearLayout(this) { Orientation = Orientation.Vertical };
// Create a label for showing the load status for the public service
_publicLayerLabel = new TextView(this);
_publicLayerLabel.Text = PublicLayerName;
_publicLayerLabel.TextSize = 12;
_publicLayerLabel.SetTextColor(Color.Gray);
layout.AddView(_publicLayerLabel);
// Create a label to show the load status of the secured layer
_secureLayerLabel = new TextView(this);
_secureLayerLabel.Text = SecureLayerName;
_secureLayerLabel.TextSize = 12;
_secureLayerLabel.SetTextColor(Color.Gray);
layout.AddView(_secureLayerLabel);
// Add the map view to the layout
layout.AddView(_myMapView);
// Show the layout in the app
SetContentView(layout);
}
示例13: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
ScrollView _scrl = new ScrollView (this);
LinearLayout _linear = new LinearLayout (this);
_linear.Orientation = Orientation.Vertical;
_scrl.AddView (_linear);
Button _addBtn = new Button (this);
_addBtn.Text = "Click to add TextViiews and EditTexts";
_linear.AddView (_addBtn);
_addBtn.Click += (sender, e) => {
// TODO Auto-generated method stub
count++;
TextView _text = new TextView (ApplicationContext);
_text.Text = "Number : " + count.ToString();
_linear.AddView(_text);
EditText _edit = new EditText(ApplicationContext);
_edit.Text = " Edit Text : " + count.ToString();
_linear.AddView(_edit);
};
this.SetContentView (_scrl);
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var layot = new LinearLayout(this);
layot.Orientation = Orientation.Vertical;
_btn1 = new Button(this);
_btn1.SetText(Resource.String.Button1Text);
_btn1.Click += OnClickButton1;
_btn2 = new Button(this);
_btn2.SetText(Resource.String.Button2Text);
_btn2.Click += OnClickButton2;
_btn3 = new Button(this);
_btn3.SetText(Resource.String.Button3Text);
_btn3.Click += OnClickButton3;
_btn4 = new Button(this);
_btn4.SetText(Resource.String.Button4Text);
_btn4.Click += OnClickButton4;
layot.AddView(_btn1);
layot.AddView(_btn2);
layot.AddView(_btn3);
layot.AddView(_btn4);
SetContentView(layot);
}
示例15: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (container == null)
{
// Currently in a layout without a container, so no reason to create our view.
return null;
}
var scroller = new ScrollView(Activity);
var llayout = new LinearLayout (Activity);
llayout.Orientation = Orientation.Vertical;
var text = new TextView(Activity);
var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics));
text.SetPadding(padding, padding, padding, padding);
text.TextSize = 24;
var doc = DoctorManager.GetDoctor (ShownPlayId);
var hosp = HospitalManager.GetHospital (doc.HospitalID);
text.Text = "Фамилия: " + doc.FirstName + "\n\n" +
"Имя: " + doc.SecondName + "\n\n" +
"Отчество: " + doc.ThirdName + "\n\n" +
"Больница: " + hosp.Name + "\n\n" +
"Адрес: " + hosp.Adress;
//Shakespeare.Dialogue[ShownPlayId];
llayout.AddView(text);
Spinner spn = new Spinner (Activity);
var preses = Presentations.GetPresentations ();
List<String> presentsTitle = new List<String>();
for (int i = 0; i < preses.Count; i++) {
for (int j = 0; j < preses[i].parts.Count; j++) {
presentsTitle.Add (preses [i].name + "." + preses [i].parts [j].name);
}
}
spn.Adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, presentsTitle.ToArray());
llayout.AddView(spn);
Button btnSlide = new Button (Activity);
btnSlide.Text = "Начать показ!";
btnSlide.Click += (sender, e) => {
var slides = new Intent ( Activity, typeof(PresentationView));
int presentationID = 0;
int partID = spn.SelectedItemPosition;
for (int i=0; (i <= preses.Count-1) && (partID > preses[i].parts.Count-1); i++){
presentationID = i+1;
partID = partID - preses [i].parts.Count;
}
slides.PutExtra ("presentationID", presentationID);
slides.PutExtra ("partID", partID);
slides.PutExtra ("doctorID", ShownPlayId);
StartActivity (slides);
};
llayout.AddView (btnSlide);
scroller.AddView (llayout);
return scroller;
}