private void ChangeBackgroundColor(int color)
        {
            LayerDrawable    layer = (LayerDrawable)Background;
            GradientDrawable shape = (GradientDrawable)layer.FindDrawableByLayerId(Resource.Id.shape_bacground);

            shape.SetColor(color);
        }
Пример #2
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            // return base.OnCreateOptionsMenu(menu);
            MenuInflater.Inflate(Resource.Menu.actionmenu, menu);
            // var dd = menu.FindItem(Resource.Id.icon_group);
            IMenuItem     item = menu.FindItem(Resource.Id.ic_group);
            LayerDrawable icon = item.Icon as LayerDrawable;

            // LayerDrawable icon = (LayerDrawable)item.Icon;
            CountDrawable badge;
            Drawable      reuse = icon.FindDrawableByLayerId(Resource.Id.ic_group_count);

            if (reuse != null && reuse is CountDrawable)
            {
                badge = (CountDrawable)reuse;
            }
            else
            {
                badge = new CountDrawable(this);
            }
            badge.setCount("8");
            badge.GetBounds = icon.Bounds;

            icon.Mutate();
            icon.SetDrawableByLayerId(Resource.Id.ic_group_count, badge);
            return(true);
        }
Пример #3
0
 public virtual void ChangeBackground()
 {
     if (outerInstance.check)
     {
         SetBackgroundResource(Resource.Drawable.background_checkbox);
         LayerDrawable    layer = (LayerDrawable)Background;
         GradientDrawable shape = (GradientDrawable)layer.FindDrawableByLayerId(Resource.Id.shape_bacground);
         shape.SetColor(outerInstance.backgroundColor);
     }
     else
     {
         SetBackgroundResource(Resource.Drawable.background_switch_ball_uncheck);
     }
 }