示例#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);
 }