/// <summary> /// Inflates a View with the given Action. /// </summary> /// <param name="action">the action to inflate</param> /// <returns>a view</returns> private View InflateAction(ActionBarAction action) { 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(action.GetDrawable()); view.Tag = action; view.SetOnClickListener(this); view.SetOnLongClickListener(this); if (action.PopUpMessage > 0) view.ContentDescription = Resources.GetString(action.PopUpMessage); return view; }
private View InflateOverflowAction(ActionBarAction action) { 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(action.GetDrawable()); var spinner = view.FindViewById<Spinner>(Resource.Id.overflow_spinner); _overflowAction.OverflowSpinner = spinner; labelView.Tag = action; labelView.SetOnClickListener(this); //view.SetOnLongClickListener(this); _overflowAction.Activity = CurrentActivity; return view; }
public void SetHomeAction(ActionBarAction action) { _homeBtn.SetOnClickListener(this); _homeBtn.Tag = action; _homeBtn.SetImageResource(action.GetDrawable()); _homeLayout.Visibility = ViewStates.Visible; 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); }