当前位置: 首页>>代码示例>>C#>>正文


C# android.getContext方法代码示例

本文整理汇总了C#中android.getContext方法的典型用法代码示例。如果您正苦于以下问题:C# android.getContext方法的具体用法?C# android.getContext怎么用?C# android.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android的用法示例。


在下文中一共展示了android.getContext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopupWindow

		/// <summary><p>Create a new popup window which can display the <tt>contentView</tt>.
		/// 	</summary>
		/// <remarks>
		/// <p>Create a new popup window which can display the <tt>contentView</tt>.
		/// The dimension of the window must be passed to this constructor.</p>
		/// <p>The popup does not provide any background. This should be handled
		/// by the content view.</p>
		/// </remarks>
		/// <param name="contentView">the popup's content</param>
		/// <param name="width">the popup's width</param>
		/// <param name="height">the popup's height</param>
		/// <param name="focusable">true if the popup can be focused, false otherwise</param>
		public PopupWindow(android.view.View contentView, int width, int height, bool focusable
			)
		{
			mOnScrollChangedListener = new _OnScrollChangedListener_131(this);
			if (contentView != null)
			{
				mContext = contentView.getContext();
				mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context
					.WINDOW_SERVICE);
			}
			setContentView(contentView);
			setWidth(width);
			setHeight(height);
			setFocusable(focusable);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:27,代码来源:PopupWindow.cs

示例2: MenuItemImpl

		/// <summary>Instantiates this menu item.</summary>
		/// <remarks>Instantiates this menu item.</remarks>
		/// <param name="menu"></param>
		/// <param name="group">
		/// Item ordering grouping control. The item will be added after
		/// all other items whose order is &lt;= this number, and before any
		/// that are larger than it. This can also be used to define
		/// groups of items for batch state changes. Normally use 0.
		/// </param>
		/// <param name="id">Unique item ID. Use 0 if you do not need a unique ID.</param>
		/// <param name="categoryOrder">The ordering for this item.</param>
		/// <param name="title">The text to display for the item.</param>
		internal MenuItemImpl([email protected] menu, int group, int
			 id, int categoryOrder, int ordering, java.lang.CharSequence title, int showAsAction
			)
		{
			if (sPrependShortcutLabel == null)
			{
				// This is instantiated from the UI thread, so no chance of sync issues 
				sPrependShortcutLabel = menu.getContext().getResources().getString([email protected]
					[email protected]_shortcut_label);
				sEnterShortcutLabel = menu.getContext().getResources().getString([email protected]
					[email protected]_enter_shortcut_label);
				sDeleteShortcutLabel = menu.getContext().getResources().getString([email protected]
					[email protected]_delete_shortcut_label);
				sSpaceShortcutLabel = menu.getContext().getResources().getString([email protected]
					[email protected]_space_shortcut_label);
			}
			mMenu = menu;
			mId = id;
			mGroup = group;
			mCategoryOrder = categoryOrder;
			mOrdering = ordering;
			mTitle = title;
			mShowAsAction = showAsAction;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:36,代码来源:MenuItemImpl.cs

示例3: ZoomButtonsController

		/// <summary>
		/// Constructor for the
		/// <see cref="ZoomButtonsController">ZoomButtonsController</see>
		/// .
		/// </summary>
		/// <param name="ownerView">
		/// The view that is being zoomed by the zoom controls. The
		/// zoom controls will be displayed aligned with this view.
		/// </param>
		public ZoomButtonsController(android.view.View ownerView)
		{
			mConfigurationChangedReceiver = new _BroadcastReceiver_150(this);
			mHandler = new _Handler_170(this);
			mContext = ownerView.getContext();
			mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context
				.WINDOW_SERVICE);
			mOwnerView = ownerView;
			mTouchPaddingScaledSq = (int)(ZOOM_CONTROLS_TOUCH_PADDING * mContext.getResources
				().getDisplayMetrics().density);
			mTouchPaddingScaledSq *= mTouchPaddingScaledSq;
			mContainer = createContainer();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:22,代码来源:ZoomButtonsController.cs

示例4: getMaxAvailableHeight

		/// <summary>
		/// Returns the maximum height that is available for the popup to be
		/// completely shown, optionally ignoring any bottom decorations such as
		/// the input method.
		/// </summary>
		/// <remarks>
		/// Returns the maximum height that is available for the popup to be
		/// completely shown, optionally ignoring any bottom decorations such as
		/// the input method. It is recommended that this height be the maximum for
		/// the popup's height, otherwise it is possible that the popup will be
		/// clipped.
		/// </remarks>
		/// <param name="anchor">The view on which the popup window must be anchored.</param>
		/// <param name="yOffset">y offset from the view's bottom edge</param>
		/// <param name="ignoreBottomDecorations">
		/// if true, the height returned will be
		/// all the way to the bottom of the display, ignoring any
		/// bottom decorations
		/// </param>
		/// <returns>
		/// The maximum available height for the popup to be completely
		/// shown.
		/// </returns>
		/// <hide>Pending API council approval.</hide>
		public virtual int getMaxAvailableHeight(android.view.View anchor, int yOffset, bool
			 ignoreBottomDecorations)
		{
			android.graphics.Rect displayFrame = new android.graphics.Rect();
			anchor.getWindowVisibleDisplayFrame(displayFrame);
			int[] anchorPos = mDrawingLocation;
			anchor.getLocationOnScreen(anchorPos);
			int bottomEdge = displayFrame.bottom;
			if (ignoreBottomDecorations)
			{
				android.content.res.Resources res = anchor.getContext().getResources();
				bottomEdge = res.getDisplayMetrics().heightPixels;
			}
			int distanceToBottom = bottomEdge - (anchorPos[1] + anchor.getHeight()) - yOffset;
			int distanceToTop = anchorPos[1] - displayFrame.top + yOffset;
			// anchorPos[1] is distance from anchor to top of screen
			int returnedHeight = System.Math.Max(distanceToBottom, distanceToTop);
			if (mBackground != null)
			{
				mBackground.getPadding(mTempRect);
				returnedHeight -= mTempRect.top + mTempRect.bottom;
			}
			return returnedHeight;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:48,代码来源:PopupWindow.cs

示例5: onKeyDown

		public override bool onKeyDown(android.view.View view, android.text.Editable content
			, int keyCode, android.view.KeyEvent @event)
		{
			int selStart;
			int selEnd;
			int pref = 0;
			if (view != null)
			{
				pref = android.text.method.TextKeyListener.getInstance().getPrefs(view.getContext
					());
			}
			{
				int a = android.text.Selection.getSelectionStart(content);
				int b = android.text.Selection.getSelectionEnd(content);
				selStart = System.Math.Min(a, b);
				selEnd = System.Math.Max(a, b);
				if (selStart < 0 || selEnd < 0)
				{
					selStart = selEnd = 0;
					android.text.Selection.setSelection(content, 0, 0);
				}
			}
			int activeStart = content.getSpanStart(android.text.method.TextKeyListener.ACTIVE
				);
			int activeEnd = content.getSpanEnd(android.text.method.TextKeyListener.ACTIVE);
			// QWERTY keyboard normal case
			int i = @event.getUnicodeChar(@event.getMetaState() | getMetaState(content));
			if (!mFullKeyboard)
			{
				int count = @event.getRepeatCount();
				if (count > 0 && selStart == selEnd && selStart > 0)
				{
					char c = content[selStart - 1];
					if (c == i || c == Sharpen.CharHelper.ToUpper(i) && view != null)
					{
						if (showCharacterPicker(view, content, c, false, count))
						{
							resetMetaState(content);
							return true;
						}
					}
				}
			}
			if (i == android.view.KeyCharacterMap.PICKER_DIALOG_INPUT)
			{
				if (view != null)
				{
					showCharacterPicker(view, content, android.view.KeyCharacterMap.PICKER_DIALOG_INPUT
						, true, 1);
				}
				resetMetaState(content);
				return true;
			}
			if (i == android.view.KeyCharacterMap.HEX_INPUT)
			{
				int start;
				if (selStart == selEnd)
				{
					start = selEnd;
					while (start > 0 && selEnd - start < 4 && Sharpen.CharHelper.Digit(content[start 
						- 1], 16) >= 0)
					{
						start--;
					}
				}
				else
				{
					start = selStart;
				}
				int ch = -1;
				try
				{
					string hex = android.text.TextUtils.substring(content, start, selEnd);
					ch = System.Convert.ToInt32(hex, 16);
				}
				catch (System.ArgumentException)
				{
				}
				if (ch >= 0)
				{
					selStart = start;
					android.text.Selection.setSelection(content, selStart, selEnd);
					i = ch;
				}
				else
				{
					i = 0;
				}
			}
			if (i != 0)
			{
				bool dead = false;
				if ((i & android.view.KeyCharacterMap.COMBINING_ACCENT) != 0)
				{
					dead = true;
					i = i & android.view.KeyCharacterMap.COMBINING_ACCENT_MASK;
				}
				if (activeStart == selStart && activeEnd == selEnd)
				{
					bool replace = false;
//.........这里部分代码省略.........
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:101,代码来源:QwertyKeyListener.cs

示例6: showCharacterPicker

		private bool showCharacterPicker(android.view.View view, android.text.Editable content
			, char c, bool insert, int count)
		{
			string set = PICKER_SETS.get(c);
			if (set == null)
			{
				return false;
			}
			if (count == 1)
			{
				new android.text.method.CharacterPickerDialog(view.getContext(), view, content, set
					, insert).show();
			}
			return true;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:QwertyKeyListener.cs

示例7: TouchDelegate

		/// <summary>Constructor</summary>
		/// <param name="bounds">
		/// Bounds in local coordinates of the containing view that should be mapped to
		/// the delegate view
		/// </param>
		/// <param name="delegateView">The view that should receive motion events</param>
		public TouchDelegate(android.graphics.Rect bounds, android.view.View delegateView
			)
		{
			mBounds = bounds;
			mSlop = android.view.ViewConfiguration.get(delegateView.getContext()).getScaledTouchSlop
				();
			mSlopBounds = new android.graphics.Rect(bounds);
			mSlopBounds.inset(-mSlop, -mSlop);
			mDelegateView = delegateView;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:TouchDelegate.cs

示例8: addView

		private void addView(android.view.View view, android.view.ViewGroup.LayoutParams 
			@params, android.view.CompatibilityInfoHolder cih, bool nest)
		{
			if (false)
			{
				android.util.Log.v("WindowManager", "addView view=" + view);
			}
			if (!(@params is android.view.WindowManagerClass.LayoutParams))
			{
				throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
			}
			android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
				.LayoutParams)@params;
			android.view.ViewRootImpl root;
			android.view.View panelParentView = null;
			lock (this)
			{
				// Here's an odd/questionable case: if someone tries to add a
				// view multiple times, then we simply bump up a nesting count
				// and they need to remove the view the corresponding number of
				// times to have it actually removed from the window manager.
				// This is useful specifically for the notification manager,
				// which can continually add/remove the same view as a
				// notification gets updated.
				int index = findViewLocked(view, false);
				if (index >= 0)
				{
					if (!nest)
					{
						throw new System.InvalidOperationException("View " + view + " has already been added to the window manager."
							);
					}
					root = mRoots[index];
					root.mAddNesting++;
					// Update layout parameters.
					view.setLayoutParams(wparams);
					root.setLayoutParams(wparams, true);
					return;
				}
				// If this is a panel window, then find the window it is being
				// attached to for future reference.
				if (wparams.type >= android.view.WindowManagerClass.LayoutParams.FIRST_SUB_WINDOW
					 && wparams.type <= android.view.WindowManagerClass.LayoutParams.LAST_SUB_WINDOW)
				{
					int count = mViews != null ? mViews.Length : 0;
					{
						for (int i = 0; i < count; i++)
						{
							if (mRoots[i].mWindow.asBinder() == wparams.token)
							{
								panelParentView = mViews[i];
							}
						}
					}
				}
				root = new android.view.ViewRootImpl(view.getContext());
				root.mAddNesting = 1;
				if (cih == null)
				{
					root.mCompatibilityInfo = new android.view.CompatibilityInfoHolder();
				}
				else
				{
					root.mCompatibilityInfo = cih;
				}
				view.setLayoutParams(wparams);
				if (mViews == null)
				{
					index = 1;
					mViews = new android.view.View[1];
					mRoots = new android.view.ViewRootImpl[1];
					mParams = new android.view.WindowManagerClass.LayoutParams[1];
				}
				else
				{
					index = mViews.Length + 1;
					object[] old = mViews;
					mViews = new android.view.View[index];
					System.Array.Copy(old, 0, mViews, 0, index - 1);
					old = mRoots;
					mRoots = new android.view.ViewRootImpl[index];
					System.Array.Copy(old, 0, mRoots, 0, index - 1);
					old = mParams;
					mParams = new android.view.WindowManagerClass.LayoutParams[index];
					System.Array.Copy(old, 0, mParams, 0, index - 1);
				}
				index--;
				mViews[index] = view;
				mRoots[index] = root;
				mParams[index] = wparams;
			}
			// do this last because it fires off messages to start doing things
			root.setView(view, wparams, panelParentView);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:94,代码来源:WindowManagerImpl.cs

示例9: init

		private void init(android.view.View decor)
		{
			mContext = decor.getContext();
			mActionView = ([email protected])decor.findViewById([email protected]
				.id.action_bar);
			mContextView = ([email protected]tionBarContextView)decor.findViewById(
				[email protected]_context_bar);
			mContainerView = ([email protected])decor.findViewById(
				[email protected]_bar_container);
			mSplitView = ([email protected])decor.findViewById([email protected]
				.id.split_action_bar);
			if (mActionView == null || mContextView == null || mContainerView == null)
			{
				throw new System.InvalidOperationException(GetType().Name + " can only be used " 
					+ "with a compatible window decor layout");
			}
			mActionView.setContextView(mContextView);
			mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
			// Older apps get the home button interaction enabled by default.
			// Newer apps need to enable it explicitly.
			setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < android.os.Build
				.VERSION_CODES.ICE_CREAM_SANDWICH);
			setHasEmbeddedTabs(mContext.getResources().getBoolean([email protected]@bool.action_bar_embed_tabs
				));
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:25,代码来源:ActionBarImpl.cs


注:本文中的android.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。