本文整理汇总了C#中LinearLayout.SetMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.SetMinimumWidth方法的具体用法?C# LinearLayout.SetMinimumWidth怎么用?C# LinearLayout.SetMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.SetMinimumWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
View view = inflater.Inflate(Resource.Layout.RoutFragment, container, false);
rout = new Rout () { Date = DateTime.Now.Date };
llContent = view.FindViewById <LinearLayout> (Resource.Id.rfContent);
llContent.SetMinimumWidth( (int) (Math.Min (Resources.DisplayMetrics.HeightPixels, Resources.DisplayMetrics.WidthPixels) / Resources.DisplayMetrics.Density));
spnDatePicker = view.FindViewById <Spinner> (Resource.Id.rfDatePicker);
string[] data = new string[2];
data [0] = DateTime.Now.Date.ToString ();
data [1] = DateTime.Now.Date.AddDays(1).ToString ();
ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, data);
spnDatePicker.Adapter = adapter;
RefreshRout ();
rfMore = view.FindViewById <ImageView> (Resource.Id.rfMore);
rfMore.Click += (object sender, EventArgs e) => {
((Vibrator)Activity.GetSystemService (Context.VibratorService)).Vibrate(100);
FragmentTransaction trans = FragmentManager.BeginTransaction ();
RoutDialogAddNew rdan = new RoutDialogAddNew ();
rdan.Show (trans, @"routPicker");
};
return view;
}
示例2: handleMealInfoLayout
public void handleMealInfoLayout (LinearLayout mealInfo, int width, int height,
LinearLayout.LayoutParams mealInfoLL, int count, JsonValue json) {
mealInfo.Orientation = Orientation.Horizontal;
mealInfo.SetMinimumWidth (25);
mealInfo.SetMinimumHeight (25);
mealInfoLL.SetMargins (5, 5, 5, 5);
mealInfo.LayoutParameters = mealInfoLL;
mealInfo.Id = count * 20 + 7;
}
示例3: handleMealObjectCreation
public void handleMealObjectCreation(LinearLayout mealObject, int width, int height, LinearLayout.LayoutParams mealObjectLL, int count, JsonValue json) {
mealObject.Orientation = Orientation.Vertical;
mealObject.SetMinimumWidth (width);
mealObject.SetMinimumHeight (height);
mealObject.LayoutParameters = mealObjectLL;
mealObject.Id = count * 20 + 5;
mealObject.AddView (CreateButtonContainer (json, count));
}
示例4: OnCreate
//--------------------------------------------------------------
// EVENT CATCHING METHODS
//--------------------------------------------------------------
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
RequestWindowFeature(WindowFeatures.NoTitle);
Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
SetContentView(Resource.Layout.Dialog);
_root = FindViewById<LinearLayout>(Resource.Id.alertContainer);
_root.SetPadding(Builder.StrokeBorderWidth, Builder.StrokeBorderWidth, Builder.StrokeBorderWidth, Builder.StrokeBorderWidth);
_root.SetMinimumWidth ((int)(WindowManager.DefaultDisplay.Width * MinWidthRatio));
_root.SetMinimumHeight((int)(WindowManager.DefaultDisplay.Height * MinHeightRatio));
if(_root.ViewTreeObserver.IsAlive)
{
_root.ViewTreeObserver.AddOnGlobalLayoutListener(this);
}
_title = FindViewById<TextView>(Resource.Id.alertTitle);
_title.SetTextColor(Builder.StrokeColor);
_title.Gravity = GravityFlags.CenterHorizontal;
if(String.IsNullOrEmpty(Builder.Title))
{
_title.Visibility = ViewStates.Gone;
}
else
{
_title.Text = Builder.Title;
}
_content = FindViewById<LinearLayout>(Resource.Id.alertContent);
switch (Builder.ContentType)
{
case DialogBuilder.DialogContentType.TextView:
if(!String.IsNullOrEmpty(Builder.Message))
{
_message = new TextView(this);
_message.Text = Builder.Message;
_message.SetTextSize(Android.Util.ComplexUnitType.Dip, TextSize);
_message.SetTextColor(Builder.TextColor);
_message.Gravity = GravityFlags.CenterHorizontal;
_content.AddView(_message, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
}
break;
case DialogBuilder.DialogContentType.EditText:
_field = new EditText(this);
_field.Hint = Builder.Message;
_field.SetTextSize(Android.Util.ComplexUnitType.Dip, TextSize);
// Limit the length
_field.SetFilters( new IInputFilter[] { new InputFilterLengthFilter(Constants.MaxLengthName) } );
_content.AddView(_field, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
break;
case DialogBuilder.DialogContentType.None:
foreach(View view in Builder.Content)
{
_content.AddView(view, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
}
break;
default:
break;
}
_buttonLayout = FindViewById<LinearLayout>(Resource.Id.buttonLayout);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) _buttonLayout.LayoutParameters;
lp.TopMargin = Builder.StrokeBorderWidth;
_buttonLayout.LayoutParameters = lp;
_positiveButton = FindViewById<ButtonStroked>(Resource.Id.positiveButton);
_negativeButton = FindViewById<ButtonStroked>(Resource.Id.negativeButton);
if(String.IsNullOrEmpty(Builder.PositiveText) && String.IsNullOrEmpty(Builder.NegativeText))
{
_positiveButton.Visibility = ViewStates.Gone;
_negativeButton.Visibility = ViewStates.Gone;
}
else if(String.IsNullOrEmpty(Builder.PositiveText))
{
_positiveButton.Visibility = ViewStates.Gone;
LinearLayout.LayoutParams lpNeg = (LinearLayout.LayoutParams) _negativeButton.LayoutParameters;
lpNeg.Weight = 2;
_negativeButton.LayoutParameters = lpNeg;
}
else if(String.IsNullOrEmpty(Builder.NegativeText))
{
_negativeButton.Visibility = ViewStates.Gone;
LinearLayout.LayoutParams lpPos = (LinearLayout.LayoutParams) _positiveButton.LayoutParameters;
lpPos.Weight = 2;
_positiveButton.LayoutParameters = lpPos;
}
else
{
LinearLayout.LayoutParams lpPos = (LinearLayout.LayoutParams) _positiveButton.LayoutParameters;
lpPos.LeftMargin = Builder.StrokeBorderWidth/2;
_positiveButton.LayoutParameters = lpPos;
LinearLayout.LayoutParams lpNeg = (LinearLayout.LayoutParams) _negativeButton.LayoutParameters;
lpNeg.RightMargin = Builder.StrokeBorderWidth/2;
_negativeButton.LayoutParameters = lpNeg;
//.........这里部分代码省略.........
示例5: CreateButtonContainer
/// <summary>
/// Creates the button container. Used to clean up code and with button for desiging meal/
/// </summary>
/// <returns>The button container object.</returns>
/// <param name="json">Json to be parsed.</param>
/// <param name="count">Count used to create unique ids.</param>
private LinearLayout CreateButtonContainer (JsonValue json, int count)
{
LinearLayout buttonCont = new LinearLayout (this);
//buttonCont.SetBackgroundColor (Android.Graphics.Color.White);
buttonCont.Orientation = Orientation.Horizontal;
buttonCont.SetMinimumWidth (25);
buttonCont.SetMinimumHeight (100);
LinearLayout.LayoutParams bcll =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.WrapContent);
bcll.SetMargins (5, 5, 5, 5);
buttonCont.LayoutParameters = bcll;
buttonCont.Visibility = Android.Views.ViewStates.Visible;
buttonCont.Id = count * 20 + 6;
// Used to hold more values
MealButton button = new MealButton (this, null,
Resource.Style.generalButtonStyle);
button.mealName = json ["Mealname"];
button.mealSize = (json ["Mealsize"]);
button.SetHeight (150);
button.mealId = (json ["Mealid"]);
button.Click += (object sender, EventArgs e) => {
Intent intent = new Intent (this, typeof(MealDesign));
LinearLayout mealDisplay = FindViewById<LinearLayout> (Resource.Id.MealDisplay);
// PRINTS
mealDisplay.RemoveAllViews ();
intent.PutExtra ("Name", button.mealName);
intent.PutExtra ("Mealsize", button.mealSize);
intent.PutExtra ("mealId", button.mealId);
StartActivityForResult (intent, 3);
// requestCode for Design page 3
};
LinearLayout.LayoutParams lp =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.MatchParent);
button.LayoutParameters = lp;
button.Text = json ["Mealname"];
button.Visibility = Android.Views.ViewStates.Visible;
button.SetBackgroundColor (Resources.GetColor (Resource.Color.orange_header));
button.Gravity = GravityFlags.Center;
buttonCont.AddView (button);
return buttonCont;
}
示例6: CreateMealInfo
/// <summary>
/// Creates the meal info area in the programmitcally generated by Json.
/// </summary>
/// <returns>The meal info container for orginal Json calls.</returns>
/// <param name="json">Json from original call to be parsed.</param>
/// <param name="recipeResult">Recipe result (Json) using info from original Json.</param>
/// <param name="count">Count used for creating unique ids.</param>
private LinearLayout CreateMealInfo (JsonValue json,
JsonValue recipeResult, int count)
{
LinearLayout mealInfo = new LinearLayout (this);
mealInfo.Orientation = Orientation.Horizontal;
mealInfo.SetMinimumWidth (25);
mealInfo.SetMinimumHeight (25);
LinearLayout.LayoutParams mealInfoLL =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.WrapContent);
mealInfoLL.SetMargins (5, 5, 5, 5);
mealInfo.LayoutParameters = mealInfoLL;
mealInfo.Id = count * 20 + 7;
// Set image icon
ImageView dinerIcon = new ImageView (this);
dinerIcon.SetImageResource (Resource.Drawable.gray_person);
dinerIcon.LayoutParameters = new
LinearLayout.LayoutParams (50, LinearLayout.LayoutParams.MatchParent);
// Finish setting the image icon
TextView mealSize = new TextView (this);
TextView recipeInfo = new TextView (this);
recipeInfo.Text = handleRecipeJson (recipeResult);
recipeInfo.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
recipeInfo.SetLines (1);
LinearLayout.LayoutParams rill =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,
LinearLayout.LayoutParams.WrapContent);
recipeInfo.LayoutParameters = rill;
mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall);
LinearLayout.LayoutParams tvll =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,
LinearLayout.LayoutParams.WrapContent);
mealSize.LayoutParameters = tvll;
mealSize.Text = json ["Mealsize"].ToString ();
recipeInfo.SetPadding (10, 0, 0, 0);
mealSize.Gravity = GravityFlags.Right;
// Add image icon
mealInfo.AddView (mealSize);
mealInfo.AddView (dinerIcon);
mealInfo.AddView (recipeInfo);
return mealInfo;
}
示例7: makeObjects
/// <summary>
/// Makes meal segments for the calendar page
/// </summary>
/// <param name="json">Json to parse information to use for displaying.</param>
/// <param name="count">Count used for unique ids.</param>
/// <param name="mealDisplay">Meal display (LinearLayout) that all of the
/// objects are going to be added to.</param>
private async void makeObjects (JsonValue json,
int count, LinearLayout mealDisplay)
{
LinearLayout mealObject = new LinearLayout (this);
mealObject.Orientation = Orientation.Vertical;
mealObject.SetMinimumWidth (25);
mealObject.SetMinimumHeight (25);
LinearLayout.LayoutParams mealObjectLL =
new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.WrapContent);
mealObject.LayoutParameters = mealObjectLL;
mealObject.Id = count * 20 + 5;
// Adds button container here
mealObject.AddView (CreateButtonContainer (json, count));
// Additional Json information to be used
string user = "tester";
int mealId = json ["Mealid"];
string url = "http://speedychef.azurewebsites.net/" +
"CalendarScreen/GetRecipesForMeal?user="
+ user + "&mealId=" + mealId;
JsonValue recipeResult = await FetchMealData (url);
mealObject.AddView (ButtonView (json, recipeResult, count));
mealObject.SetPadding (0, 0, 0, 40);
mealDisplay.AddView (mealObject);
}