Пример #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);
 }
Пример #2
0
 /// <summary>Gets the list popup window which is lazily initialized.</summary>
 /// <remarks>Gets the list popup window which is lazily initialized.</remarks>
 /// <returns>The popup.</returns>
 private android.widget.ListPopupWindow getListPopupWindow()
 {
     if (mListPopupWindow == null)
     {
         mListPopupWindow = new android.widget.ListPopupWindow(getContext());
         mListPopupWindow.setAdapter(mAdapter);
         mListPopupWindow.setAnchorView(this);
         mListPopupWindow.setModal(true);
         mListPopupWindow.setOnItemClickListener(mCallbacks);
         mListPopupWindow.setOnDismissListener(mCallbacks);
     }
     return(mListPopupWindow);
 }
Пример #3
0
		/// <summary>Gets the list popup window which is lazily initialized.</summary>
		/// <remarks>Gets the list popup window which is lazily initialized.</remarks>
		/// <returns>The popup.</returns>
		private android.widget.ListPopupWindow getListPopupWindow()
		{
			if (mListPopupWindow == null)
			{
				mListPopupWindow = new android.widget.ListPopupWindow(getContext());
				mListPopupWindow.setAdapter(mAdapter);
				mListPopupWindow.setAnchorView(this);
				mListPopupWindow.setModal(true);
				mListPopupWindow.setOnItemClickListener(mCallbacks);
				mListPopupWindow.setOnDismissListener(mCallbacks);
			}
			return mListPopupWindow;
		}
Пример #4
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;
		}