本文整理汇总了C#中Android.Views.View.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetPadding方法的具体用法?C# View.SetPadding怎么用?C# View.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.SetPadding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MovieCategoryViewHolder
public MovieCategoryViewHolder (View itemView, int viewType) : base (itemView) {
//Creates and caches our views defined in our layout
if (viewType == 0) // TODO: Calculate this. I don't think this is a good way to ensure consistent presentation across different device resolutions
itemView.SetPadding (itemView.PaddingLeft, itemView.PaddingTop + 110, itemView.PaddingRight, itemView.PaddingBottom);
this.CategoryName = itemView.FindViewById<TextView>(Resource.Id.movie_category_item_txtCategoryName);
this.MovieList = itemView.FindViewById<RecyclerView>(Resource.Id.movie_category_item_lstMovies);
}
示例2: Apply
public override void Apply(View view, ViewGroup.LayoutParams layoutParams)
{
view.SetPadding(
Left.HasValue ? Left.Value : All.HasValue ? All.Value : view.PaddingLeft,
Top.HasValue ? Top.Value : All.HasValue ? All.Value : view.PaddingTop,
Right.HasValue ? Right.Value : All.HasValue ? All.Value : view.PaddingRight,
Bottom.HasValue ? Bottom.Value : All.HasValue ? All.Value : view.PaddingBottom
);
}
示例3: AddItem
public void AddItem(string itemID, View item)
{
if (this.items.Count == 0)
{
item.LayoutParameters = new ViewGroup.LayoutParams(92, 92);
item.SetPadding(10, 10, 10, 10);
this.items[itemID] = item;
LinearLayout firstRow = new LinearLayout(this.Context);
firstRow.Orientation = Orientation.Horizontal;
firstRow.SetHorizontalGravity(GravityFlags.Center);
firstRow.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
firstRow.AddView(item);
this.rows[0] = firstRow;
this.baseLayout.AddView(firstRow);
} else
{
if (this.items.ContainsKey(itemID))
{
throw new InvalidOperationException("An item with the same key already exists in the scroll view!");
}//end if
// Get the last row (LinearLayout)
int lastRowIndex = this.rows.Keys.Max();
LinearLayout lastRow = this.rows[lastRowIndex];
item.LayoutParameters = new ViewGroup.LayoutParams(92, 92);
item.SetPadding(10, 10, 10, 10);
this.items[itemID] = item;
if (lastRow.ChildCount < 3)
{
// Last row still has room
lastRow.AddView(item);
} else
{
LinearLayout newRow = new LinearLayout(this.Context);
newRow.Orientation = Orientation.Horizontal;
newRow.SetHorizontalGravity(GravityFlags.Center);
newRow.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
newRow.AddView(item);
this.rows[++lastRowIndex] = newRow;
this.baseLayout.AddView(newRow);
}//end if else
}//end if else
}
示例4: UpdateTopBottomPadding
private static void UpdateTopBottomPadding(View view, int topPadding, int bottomPadding)
{
if (ViewCompat.IsPaddingRelative(view))
{
ViewCompat.SetPaddingRelative(view, ViewCompat.GetPaddingStart(view), topPadding,
ViewCompat.GetPaddingEnd(view), bottomPadding);
}
else
{
view.SetPadding(view.PaddingLeft, topPadding, view.PaddingRight, bottomPadding);
}
}