Example #1
0
 public virtual bool tryShow()
 {
     mPopup = new android.widget.ListPopupWindow(mContext, null, [email protected]
                                                 .popupMenuStyle);
     mPopup.setOnDismissListener(this);
     mPopup.setOnItemClickListener(this);
     mAdapter = new [email protected](this, mMenu
                                                                            );
     mPopup.setAdapter(mAdapter);
     mPopup.setModal(true);
     android.view.View anchor = mAnchorView;
     if (anchor != null)
     {
         bool addGlobalListener = mTreeObserver == null;
         mTreeObserver = anchor.getViewTreeObserver();
         // Refresh to latest
         if (addGlobalListener)
         {
             mTreeObserver.addOnGlobalLayoutListener(this);
         }
         anchor.addOnAttachStateChangeListener(this);
         mPopup.setAnchorView(anchor);
     }
     else
     {
         return(false);
     }
     mPopup.setContentWidth(System.Math.Min(measureContentWidth(mAdapter), mPopupMaxWidth
                                            ));
     mPopup.setInputMethodMode(android.widget.PopupWindow.INPUT_METHOD_NOT_NEEDED);
     mPopup.show();
     mPopup.getListView().setOnKeyListener(this);
     return(true);
 }
Example #2
0
 public virtual void onItemClick(object parent, android.view.View view, int position
                                 , long id)
 {
     [email protected] adapter = mAdapter;
     adapter.mAdapterMenu.performItemAction((([email protected]
                                              )adapter.getItem(position)), 0);
 }
Example #3
0
		public virtual bool tryShow()
		{
			mPopup = new android.widget.ListPopupWindow(mContext, null, [email protected]
				.popupMenuStyle);
			mPopup.setOnDismissListener(this);
			mPopup.setOnItemClickListener(this);
			mAdapter = new [email protected](this, mMenu
				);
			mPopup.setAdapter(mAdapter);
			mPopup.setModal(true);
			android.view.View anchor = mAnchorView;
			if (anchor != null)
			{
				bool addGlobalListener = mTreeObserver == null;
				mTreeObserver = anchor.getViewTreeObserver();
				// Refresh to latest
				if (addGlobalListener)
				{
					mTreeObserver.addOnGlobalLayoutListener(this);
				}
				anchor.addOnAttachStateChangeListener(this);
				mPopup.setAnchorView(anchor);
			}
			else
			{
				return false;
			}
			mPopup.setContentWidth(System.Math.Min(measureContentWidth(mAdapter), mPopupMaxWidth
				));
			mPopup.setInputMethodMode(android.widget.PopupWindow.INPUT_METHOD_NOT_NEEDED);
			mPopup.show();
			mPopup.getListView().setOnKeyListener(this);
			return true;
		}