本文整理汇总了C#中LinearLayout.LayoutParams类的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.LayoutParams类的具体用法?C# LinearLayout.LayoutParams怎么用?C# LinearLayout.LayoutParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearLayout.LayoutParams类属于命名空间,在下文中一共展示了LinearLayout.LayoutParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
public override View OnCreateView (LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle)
{
var frame = (FrameLayout)layoutInflater.Inflate(Resource.Layout.zxingscannerfragmentlayout, null);
var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
try
{
scanner = new ZXingSurfaceView (this.Activity, ScanningOptions, callback);
frame.AddView(scanner, layoutParams);
if (!UseCustomView)
{
zxingOverlay = new ZxingOverlayView (this.Activity);
zxingOverlay.TopText = TopText ?? "";
zxingOverlay.BottomText = BottomText ?? "";
frame.AddView (zxingOverlay, layoutParams);
}
else if (CustomOverlayView != null)
{
frame.AddView(CustomOverlayView, layoutParams);
}
}
catch (Exception ex)
{
Console.WriteLine ("Create Surface View Failed: " + ex);
}
return frame;
}
示例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: Initialize
void Initialize()
{
Orientation = Orientation.Horizontal;
var ps = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.MatchParent,
1.0f);
ps.SetMargins (0, 0, 0, 0);
mLeftView = new CardboardOverlayEyeView (Context);
mLeftView.LayoutParameters = ps;
AddView(mLeftView);
mRightView = new CardboardOverlayEyeView (Context);
mRightView.LayoutParameters = ps;
AddView(mRightView);
// Set some reasonable defaults.
SetDepthOffset(0.016f);
SetColor(Color.Rgb (150, 255, 180));
Visibility = ViewStates.Visible;
mTextFadeAnimation = new AlphaAnimation(1.0f, 0.0f);
mTextFadeAnimation.Duration = 5000;
}
示例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: OnResume
public override void OnResume ()
{
base.OnResume ();
var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
layoutParams.Weight = 1;
try
{
scanner = new ZXingSurfaceView (this.Activity, ScanningOptions, Callback);
frame.AddView(scanner, layoutParams);
if (!UseCustomView)
{
zxingOverlay = new ZxingOverlayView (this.Activity);
zxingOverlay.TopText = TopText ?? "";
zxingOverlay.BottomText = BottomText ?? "";
frame.AddView (zxingOverlay, layoutParams);
}
else if (CustomOverlayView != null)
{
frame.AddView(CustomOverlayView, layoutParams);
}
}
catch (Exception ex)
{
Console.WriteLine ("Create Surface View Failed: " + ex);
}
}
示例6: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.ActivityControlsVisualPerformance);
LinearLayout linearLayoutWrapper = FindViewById<LinearLayout>(Resource.Id.linearLayout_wrapper);
Stopwatch = new Stopwatch();
Stopwatch.Start();
//TODO: test Out of memory
for (int j = 0; j < 450; j++)
{
LinearLayout linearLayout = new LinearLayout(this);
LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
linearLayout.Orientation = Orientation.Horizontal;
linearLayoutWrapper.AddView(linearLayout, linearLayoutParams);
for (int i = 0; i < 20; i++)
{
Button button = new Button(this);
button.Text = "X";
button.Click += Button_Click;
linearLayoutParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WrapContent);
linearLayoutParams.Weight = 1;
linearLayout.AddView(button, linearLayoutParams);
}
}
}
示例7: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffleroot, container, false);
locationcontainerlayout=(LinearLayout)rootview.FindViewById (Resource.Id.raffleroot_locationcontainer_linerlayout);
TextView locationtext=new TextView(nn_activity);
locationtext.Text=nn_location;
LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
param.Gravity=global::Android.Views.GravityFlags.Center;
param.LeftMargin=TapUtil.dptodx(5);
locationtext.LayoutParameters=param;
locationcontainerlayout.AddView (locationtext);
//initialize listview
listview=(ListView)rootview.FindViewById(Resource.Id.raffleroot_eventlist_listview);
listview.Divider = null;
adapter = new EventListAdapter (nn_activity,eventcards);
listview.Adapter = adapter;
//adapter.NotifyListChange ();
listview.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => {
(nn_activity as HomeScreen).ShowRaffleDetailFragment(e.Position);
};
return rootview;
}
示例8: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
this.RequestWindowFeature (WindowFeatures.NoTitle);
this.Window.AddFlags (WindowManagerFlags.Fullscreen); //to show
this.Window.AddFlags (WindowManagerFlags.KeepScreenOn); //Don't go to sleep while scanning
scanner = new ZxingSurfaceView (this, ScanningOptions);
SetContentView (scanner);
var layoutParams = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
if (!UseCustomView)
{
zxingOverlay = new ZxingOverlayView (this);
zxingOverlay.TopText = TopText ?? "";
zxingOverlay.BottomText = BottomText ?? "";
this.AddContentView (zxingOverlay, layoutParams);
}
else if (CustomOverlayView != null)
{
this.AddContentView(CustomOverlayView, layoutParams);
}
OnCancelRequested += HandleCancelScan;
OnAutoFocusRequested += HandleAutoFocus;
OnTorchRequested += HandleTorchRequested;
}
示例9: Calendar_DaySlotLoading
private void Calendar_DaySlotLoading(object sender, CalendarDaySlotLoadingEventArgs e)
{
// get day
Java.Util.Date date = e.Date;
Java.Util.Calendar cal = Java.Util.Calendar.GetInstance(Java.Util.Locale.English);
cal.Time = date;
int day = cal.Get(Java.Util.CalendarField.DayOfMonth);
// create day slot layout container
CalendarDaySlotBase layout = new CalendarDaySlotBase(ApplicationContext);
layout.SetGravity(GravityFlags.Top);
layout.SetVerticalGravity(GravityFlags.Top);
layout.Orientation = Orientation.Vertical;
layout.SetPadding(5, 5, 5, 5);
LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
layout.LayoutParameters = linearLayoutParams;
// create text element
TextView tv = new TextView(ApplicationContext);
//LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
//vv.LayoutParameters = linearLayoutParams;
tv.Gravity = GravityFlags.Top;
tv.Text = day.ToString();
if (e.AdjacentDay)
{
// format adjacent day text
tv.SetTextColor(Android.Graphics.Color.DarkGray);
}
// add text element to layout
layout.AddView(tv);
// add weather image for certain days
if (day >= 14 && day <= 23)
{
ImageView iv = new ImageView(ApplicationContext);
switch (day % 5)
{
case 0: iv.SetImageResource(Resource.Drawable.Cloudy);
break;
case 1: iv.SetImageResource(Resource.Drawable.PartlyCloudy);
break;
case 2: iv.SetImageResource(Resource.Drawable.Rain);
break;
case 3: iv.SetImageResource(Resource.Drawable.Storm);
break;
case 4: iv.SetImageResource(Resource.Drawable.Sun);
break;
}
layout.AddView(iv);
}
// finally, set layout to day slot
e.DaySlot = layout;
}
示例10: BaseMenu
public BaseMenu(Context context)
: base(context)
{
LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
Alpha = 0.0f;
Visibility = ViewStates.Gone;
}
示例11: SwitchToFirstLayout
void SwitchToFirstLayout ()
{
firstLayout.Visibility = ViewStates.Visible;
var parms = secondLayout.LayoutParameters as LinearLayout.LayoutParams;
parms = new LinearLayout.LayoutParams (parms);
parms.Height = 1;
parms.Gravity = GravityFlags.Center;
secondLayout.LayoutParameters = parms;
}
示例12: SwitchToSecondLayout
void SwitchToSecondLayout ()
{
var parms = secondLayout.LayoutParameters as LinearLayout.LayoutParams;
parms = new LinearLayout.LayoutParams (parms);
parms.Height = ViewGroup.LayoutParams.WrapContent;
parms.Gravity = GravityFlags.Center;
secondLayout.LayoutParameters = parms;
firstLayout.Visibility = ViewStates.Gone;
}
示例13: GetPropertyWindowLayout
public override View GetPropertyWindowLayout(Android.Content.Context context)
{
/**
* Property Window
* */
int width = (context.Resources.DisplayMetrics.WidthPixels) / 2;
LinearLayout propertylayout = new LinearLayout(context); //= new LinearLayout(context);
propertylayout.Orientation = Android.Widget.Orientation.Vertical;
LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
width * 2, 5);
layoutParams1.SetMargins(0, 20, 0, 0);
TextView labelDisplayMode = new TextView(context);
labelDisplayMode.TextSize = 20;
labelDisplayMode.Text = "LabelDisplay Mode";
Spinner selectLabelMode = new Spinner(context);
List<String> adapter = new List<String>() { "FloatAllPoints", "NearestPoint", "GroupAllPoints" };
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
(context, Android.Resource.Layout.SimpleSpinnerItem, adapter);
dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
selectLabelMode.Adapter = dataAdapter;
selectLabelMode.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
{
String selectedItem = dataAdapter.GetItem(e.Position);
ChartTrackballBehavior trackballBehavior = (chart.Behaviors.Get(0) as ChartTrackballBehavior);
if (selectedItem.Equals("NearestPoint"))
{
trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.NearestPoint;
}
else if (selectedItem.Equals("FloatAllPoints"))
{
trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.FloatAllPoints;
}
else if (selectedItem.Equals("GroupAllPoints"))
{
trackballBehavior.LabelDisplayMode = TrackballLabelDisplayMode.GroupAllPoints;
}
};
propertylayout.AddView(labelDisplayMode);
SeparatorView separate = new SeparatorView(context, width * 2);
separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5);
propertylayout.AddView(separate, layoutParams1);
propertylayout.AddView(selectLabelMode);
return propertylayout;
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
this.RequestWindowFeature(WindowFeatures.NoTitle);
this.Window.AddFlags(WindowManagerFlags.Fullscreen); //to show
this.Window.AddFlags(WindowManagerFlags.KeepScreenOn); //Don't go to sleep while scanning
scanner = new ZxingSurfaceView(this);
SetContentView(scanner);
var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
var customLayout = LayoutInflater.FromContext(this).Inflate(ZXing.YuvTool.Resource.Layout.Main, null);
var buttonCapture = customLayout.FindViewById<Button>(ZXing.YuvTool.Resource.Id.MyButton);
buttonCapture.Click += (sender, args) =>
{
var yuv = scanner.GetLastYuvImage();
var width = scanner.GetLastWidth();
var height = scanner.GetLastHeight();
if (yuv == null)
return;
using (var stream = this.OpenFileOutput("YuvData.txt", FileCreationMode.WorldReadable))
using (var sw = new System.IO.StreamWriter(stream))
{
sw.Write(Convert.ToBase64String(yuv.GetYuvData()));
sw.WriteLine();
sw.WriteLine("WIDTH=" + width + ", HEIGHT="+ height);
}
using (var stream = this.OpenFileOutput("YuvImage.jpg", FileCreationMode.WorldReadable))
using (var sw = new System.IO.StreamWriter(stream))
{
yuv.CompressToJpeg(new Rect(0, 0, width, height), 100, stream);
}
var intent = new Intent(this, typeof (AnalyzeImageActivity));
intent.PutExtra("IMGWIDTH", yuv.Width);
intent.PutExtra("IMGHEIGHT", yuv.Height);
StartActivity(intent);
};
this.AddContentView(customLayout, layoutParams);
}
示例15: OnCreate
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
mView = new View(this.Activity);
GradientDrawable background = (GradientDrawable) Resources.GetDrawable(Resource.Drawable.rounded_rect);
background.SetColor(mColour);
mView.SetBackgroundDrawable(background);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, Xamarin.ActionbarSherlockBinding.App.ActionBar.LayoutParams.FillParent, mWeight);
lp.SetMargins(marginLeft, marginTop, marginRight, marginBottom);
mView.LayoutParameters = lp;
}