private ImageView CreateIcon(SwipeMenuItem item)
        {
            ImageView iv = new ImageView(Context);

            iv.SetImageDrawable(item.Icon);
            return(iv);
        }
        private TextView CreateTitle(SwipeMenuItem item)
        {
            TextView tv = new TextView(Context);

            tv.Text     = item.Title;
            tv.Gravity  = GravityFlags.Center;
            tv.TextSize = item.TitleSize;
            tv.SetTextColor(item.TitleColor);
            return(tv);
        }
        private void AddItem(SwipeMenuItem item, int id)
        {
            LayoutParams param  = new LayoutParams(item.Width, LayoutParams.MatchParent);
            LinearLayout parent = new LinearLayout(Context);

            parent.Id = id;
            parent.SetGravity(GravityFlags.Center);
            parent.Orientation      = global::Android.Widget.Orientation.Vertical;
            parent.LayoutParameters = param;
            parent.SetBackgroundDrawable(item.Background);
            parent.SetOnClickListener(this);
            AddView(parent);

            if (item.Icon != null)
            {
                parent.AddView(CreateIcon(item));
            }

            if (!String.IsNullOrEmpty(item.Title))
            {
                parent.AddView(CreateTitle(item));
            }
        }
Beispiel #4
0
 public void RemoveMenuItem(SwipeMenuItem item)
 {
     mItems.Remove(item);
 }
Beispiel #5
0
 public void AddMenuItem(SwipeMenuItem item)
 {
     mItems.Add(item);
 }