/// <summary> /// Inflates a View with the given Action. /// </summary> /// <param name="legacyBarAction">the legacyBarAction to inflate</param> /// <returns>a view</returns> private View InflateAction(LegacyBarAction legacyBarAction) { var view = _inflater.Inflate(Resource.Layout.actionbar_item, _actionsView, false); if (null != ItemBackgroundDrawable) { view.SetBackgroundDrawable(ItemBackgroundDrawable.GetConstantState().NewDrawable()); } else if (ItemBackgroundDrawableRaw > 0) { view.SetBackgroundResource(ItemBackgroundDrawableRaw); } var labelView = view.FindViewById <ImageButton>(Resource.Id.actionbar_item); labelView.SetImageResource(legacyBarAction.GetDrawable()); view.Tag = legacyBarAction; view.SetOnClickListener(this); view.SetOnLongClickListener(this); if (legacyBarAction.PopUpMessage > 0) { view.ContentDescription = Resources.GetString(legacyBarAction.PopUpMessage); } return(view); }
private View InflateOverflowAction(LegacyBarAction legacyBarAction) { var view = _inflater.Inflate(Resource.Layout.overflowactionbar_item, _actionsView, false); var labelView = view.FindViewById <ImageButton>(Resource.Id.actionbar_item); if (null != ItemBackgroundDrawable) { labelView.SetBackgroundDrawable(ItemBackgroundDrawable.GetConstantState().NewDrawable()); } else if (ItemBackgroundDrawableRaw > 0) { labelView.SetBackgroundResource(ItemBackgroundDrawableRaw); } labelView.SetImageResource(legacyBarAction.GetDrawable()); var spinner = view.FindViewById <Spinner>(Resource.Id.overflow_spinner); _overflowLegacyBarAction.OverflowSpinner = spinner; labelView.Tag = legacyBarAction; labelView.SetOnClickListener(this); //view.SetOnLongClickListener(this); return(view); }
public void SetHomeAction(LegacyBarAction legacyBarAction) { _homeBtn.SetOnClickListener(this); _homeBtn.Tag = legacyBarAction; _homeBtn.SetImageResource(legacyBarAction.GetDrawable()); _homeLayout.Visibility = ViewStates.Visible; _backIndicator.SetBackgroundResource(LightIcons ? Resource.Drawable.actionbar_back_indicator : Resource.Drawable.actionbar_back_indicator_dark); if (null != ItemBackgroundDrawable) { _homeBtn.SetBackgroundDrawable(ItemBackgroundDrawable.GetConstantState().NewDrawable()); } else if (ItemBackgroundDrawableRaw > 0) { _homeBtn.SetBackgroundResource(ItemBackgroundDrawableRaw); } ((LayoutParams)_titleLayout.LayoutParameters).AddRule(LayoutRules.RightOf, Resource.Id.actionbar_home_bg); }