Beispiel #1
0
        private ImageView CreateIcon(SwipeMenuItem item)
        {
            ImageView iv = new ImageView(Context);

            iv.SetImageDrawable(item.Icon);
            return(iv);
        }
Beispiel #2
0
        private TextView CreateTitle(SwipeMenuItem item)
        {
            var view = new TextView(Context)
            {
                Text     = (item.Title),
                Gravity  = Android.Views.GravityFlags.Center,
                TextSize = item.TitleSize,
                //tv.SetTextColor(item.TitleColor);
            };

            view.SetTextColor(Color.White);
            return(view);
        }
Beispiel #3
0
        private void AddItem(SwipeMenuItem item, int id)
        {
            LayoutParams paramss = new LayoutParams(item.Width, LayoutParams.MatchParent);
            LayoutParams paramsP = new LayoutParams(item.Width - 2, LayoutParams.MatchParent);
            LinearLayout boss    = new LinearLayout(Context)
            {
                Orientation      = Orientation.Horizontal,
                LayoutParameters = paramss
            };
            LinearLayout parent = new LinearLayout(Context)
            {
                Id               = id,
                Orientation      = Orientation.Vertical,
                LayoutParameters = paramsP,
                Background       = item.Background
            };

            parent.SetGravity(Android.Views.GravityFlags.Center);
            parent.SetOnClickListener(this);
            AddView(boss);

            if (item.Icon != null)
            {
                parent.AddView(CreateIcon(item));
            }
            if (!TextUtils.IsEmpty(item.Title))
            {
                parent.AddView(CreateTitle(item));
            }
            View view = new View(Context)
            {
                LayoutParameters = new LayoutParams(2, LayoutParams.MatchParent),
                Background       = new ColorDrawable(Color.LightGray)
            };

            boss.AddView(view);
            boss.AddView(parent);
        }
Beispiel #4
0
 public void RemoveMenuItem(SwipeMenuItem item)
 {
     mItems.Remove(item);
 }
Beispiel #5
0
 public void AddMenuItem(SwipeMenuItem item)
 {
     mItems.Add(item);
 }