当前位置: 首页>>代码示例>>C#>>正文


C# View.SetPadding方法代码示例

本文整理汇总了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);
		}
开发者ID:Robert-Altland,项目名称:MovieExplorer,代码行数:7,代码来源:MovieCategoryViewHolder.cs

示例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
         );
 }
开发者ID:jlarsson,项目名称:MonoDroid.Simplified,代码行数:9,代码来源:PaddingStyle.cs

示例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
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:62,代码来源:LScrollView.cs

示例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);
     }
 }
开发者ID:slown1,项目名称:Xamarin.Tsnackbar,代码行数:12,代码来源:SnackbarLayout.cs


注:本文中的Android.Views.View.SetPadding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。