Пример #1
0
        private ImageView CreateIcon(SwipeMenuItem item)
        {
            ImageView iv = new ImageView(Context);

            iv.SetImageDrawable(item.Icon);
            return(iv);
        }
Пример #2
0
        private TextView CreateTitle(SwipeMenuItem item)
        {
            TextView tv = new TextView(Context)
            {
                Text     = item.Title,
                Gravity  = GravityFlags.Center,
                TextSize = item.TitleSize
            };

            tv.SetTextColor(item.TitleColor);
            return(tv);
        }
Пример #3
0
        private void AddItem(SwipeMenuItem item, int id)
        {
            LayoutParams layoutParams = new LayoutParams(item.Width, LayoutParams.MatchParent);
            LinearLayout parent       = new LinearLayout(Context)
            {
                Id               = id,
                Orientation      = Orientation.Vertical,
                LayoutParameters = layoutParams,
                Background       = item.Background
            };

            parent.SetGravity(GravityFlags.Center);
            parent.SetOnClickListener(this);
            AddView(parent);
            if (item.Icon != null)
            {
                parent.AddView(CreateIcon(item));
            }
            if (!TextUtils.IsEmpty(item.Title))
            {
                parent.AddView(CreateTitle(item));
            }
        }
Пример #4
0
 public void RemoveMenuItem(SwipeMenuItem item)
 {
     MenuItems.Remove(item);
 }
Пример #5
0
 public void AddMenuItem(SwipeMenuItem item)
 {
     MenuItems.Add(item);
 }