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


C# android.getResources方法代码示例

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


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

示例1: Toast

		/// <summary>Construct an empty Toast object.</summary>
		/// <remarks>
		/// Construct an empty Toast object.  You must call
		/// <see cref="setView(android.view.View)">setView(android.view.View)</see>
		/// before you
		/// can call
		/// <see cref="show()">show()</see>
		/// .
		/// </remarks>
		/// <param name="context">
		/// The context to use.  Usually your
		/// <see cref="android.app.Application">android.app.Application</see>
		/// or
		/// <see cref="android.app.Activity">android.app.Activity</see>
		/// object.
		/// </param>
		public Toast(android.content.Context context)
		{
			mContext = context;
			mTN = new android.widget.Toast.TN();
			mTN.mY = context.getResources().getDimensionPixelSize([email protected]_y_offset
				);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:23,代码来源:Toast.cs

示例2: loadAnimation

		/// <summary>
		/// Loads an
		/// <see cref="Animation">Animation</see>
		/// object from a resource
		/// </summary>
		/// <param name="context">Application context used to access resources</param>
		/// <param name="id">The resource id of the animation to load</param>
		/// <returns>The animation object reference by the specified id</returns>
		/// <exception cref="android.content.res.Resources.NotFoundException">when the animation cannot be loaded
		/// 	</exception>
		public static android.view.animation.Animation loadAnimation(android.content.Context
			 context, int id)
		{
			android.content.res.XmlResourceParser parser = null;
			try
			{
				parser = context.getResources().getAnimation(id);
				return createAnimationFromXml(context, parser);
			}
			catch (org.xmlpull.v1.XmlPullParserException ex)
			{
				android.content.res.Resources.NotFoundException rnf = new android.content.res.Resources
					.NotFoundException("Can't load animation resource ID #0x" + Sharpen.Util.IntToHexString
					(id));
				rnf.InnerException = ex;
				throw rnf;
			}
			catch (System.IO.IOException ex)
			{
				android.content.res.Resources.NotFoundException rnf = new android.content.res.Resources
					.NotFoundException("Can't load animation resource ID #0x" + Sharpen.Util.IntToHexString
					(id));
				rnf.InnerException = ex;
				throw rnf;
			}
			finally
			{
				if (parser != null)
				{
					parser.close();
				}
			}
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:43,代码来源:AnimationUtils.cs

示例3: ViewConfiguration

		/// <summary>Creates a new configuration for the specified context.</summary>
		/// <remarks>
		/// Creates a new configuration for the specified context. The configuration depends on
		/// various parameters of the context, like the dimension of the display or the density
		/// of the display.
		/// </remarks>
		/// <param name="context">The application context used to initialize this view configuration.
		/// 	</param>
		/// <seealso cref="get(android.content.Context)"></seealso>
		/// <seealso cref="android.util.DisplayMetrics">android.util.DisplayMetrics</seealso>
		private ViewConfiguration (android.content.Context context)
		{
			android.content.res.Resources res = context.getResources ();
			android.util.DisplayMetrics metrics = res.getDisplayMetrics ();
			android.content.res.Configuration config = res.getConfiguration ();
			float density = metrics.density;
			float sizeAndDensity;
			if (config.isLayoutSizeAtLeast (android.content.res.Configuration.SCREENLAYOUT_SIZE_XLARGE))
				sizeAndDensity = density * 1.5f;
			else
				sizeAndDensity = density;
			mEdgeSlop = (int)(sizeAndDensity * EDGE_SLOP + 0.5f);
			mFadingEdgeLength = (int)(sizeAndDensity * FADING_EDGE_LENGTH + 0.5f);
			mMinimumFlingVelocity = (int)(density * MINIMUM_FLING_VELOCITY + 0.5f);
			mMaximumFlingVelocity = (int)(density * MAXIMUM_FLING_VELOCITY + 0.5f);
			mScrollbarSize = (int)(density * SCROLL_BAR_SIZE + 0.5f);
			mTouchSlop = (int)(sizeAndDensity * TOUCH_SLOP + 0.5f);
			mPagingTouchSlop = (int)(sizeAndDensity * PAGING_TOUCH_SLOP + 0.5f);
			mDoubleTapSlop = (int)(sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
			mScaledTouchExplorationTapSlop = (int)(density * TOUCH_EXPLORATION_TAP_SLOP + 0.5f
				);
			mWindowTouchSlop = (int)(sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
			// Size of the screen in bytes, in ARGB_8888 format
			mMaximumDrawingCacheSize = 4 * metrics.widthPixels * metrics.heightPixels;
			mOverscrollDistance = (int)(sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
			mOverflingDistance = (int)(sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
			mFadingMarqueeEnabled = false;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:38,代码来源:ViewConfiguration.cs

示例4: init

		private void init(android.content.Context context)
		{
			android.content.res.Resources res = context.getResources();
			mShiftIcon = res.getDrawable([email protected]_keyboard_shift);
			mShiftLockIcon = res.getDrawable([email protected]_keyboard_shift_locked
				);
			sSpacebarVerticalCorrection = res.getDimensionPixelOffset([email protected]
				.password_keyboard_spacebar_vertical_correction);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:9,代码来源:PasswordEntryKeyboard.cs

示例5: ActionMenuItemView

		public ActionMenuItemView(android.content.Context context, android.util.AttributeSet
			 attrs, int defStyle) : base(context, attrs, defStyle)
		{
			android.content.res.Resources res = context.getResources();
			mAllowTextWithIcon = res.getBoolean([email protected]@bool.config_allowActionMenuItemTextWithIcon
				);
			mShowTextAllCaps = res.getBoolean([email protected]@bool.config_actionMenuItemAllCaps
				);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:9,代码来源:ActionMenuItemView.cs

示例6: ActionMenuView

		public ActionMenuView(android.content.Context context, android.util.AttributeSet 
			attrs) : base(context, attrs)
		{
			// dips
			// dips
			setBaselineAligned(false);
			float density = context.getResources().getDisplayMetrics().density;
			mMinCellSize = (int)(MIN_CELL_SIZE * density);
			mGeneratedItemPadding = (int)(GENERATED_ITEM_PADDING * density);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:10,代码来源:ActionMenuView.cs

示例7: MenuPopupHelper

		public MenuPopupHelper(android.content.Context context, [email protected]
			 menu, android.view.View anchorView, bool overflowOnly)
		{
			mContext = context;
			mInflater = android.view.LayoutInflater.from(context);
			mMenu = menu;
			mOverflowOnly = overflowOnly;
			android.content.res.Resources res = context.getResources();
			mPopupMaxWidth = System.Math.Max(res.getDisplayMetrics().widthPixels / 2, res.getDimensionPixelSize
				([email protected]_prefDialogWidth));
			mAnchorView = anchorView;
			menu.addMenuPresenter(this);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:13,代码来源:MenuPopupHelper.cs

示例8: get

		// Size of the screen in bytes, in ARGB_8888 format
		/// <summary>Returns a configuration for the specified context.</summary>
		/// <remarks>
		/// Returns a configuration for the specified context. The configuration depends on
		/// various parameters of the context, like the dimension of the display or the
		/// density of the display.
		/// </remarks>
		/// <param name="context">The application context used to initialize the view configuration.
		/// 	</param>
		public static android.view.ViewConfiguration get(android.content.Context context)
		{
			android.util.DisplayMetrics metrics = context.getResources().getDisplayMetrics();
			int density = (int)(100.0f * metrics.density);
			android.view.ViewConfiguration configuration = sConfigurations.get(density);
			if (configuration == null)
			{
				configuration = new android.view.ViewConfiguration(context);
				sConfigurations.put(density, configuration);
			}
			return configuration;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:21,代码来源:ViewConfiguration.cs

示例9: AppWidgetManager

		private AppWidgetManager(android.content.Context context)
		{
			mContext = context;
			mDisplayMetrics = context.getResources().getDisplayMetrics();
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:5,代码来源:AppWidgetManager.cs

示例10: initFromContext

			internal static void initFromContext(android.content.Context context)
			{
				float ppi = context.getResources().getDisplayMetrics().density * 160.0f;
				PHYSICAL_COEF = android.hardware.SensorManager.GRAVITY_EARTH * 39.37f * ppi * 0.84f;
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:5,代码来源:OverScroller.cs

示例11: isLandscapeMode

		internal static bool isLandscapeMode(android.content.Context context)
		{
			return context.getResources().getConfiguration().orientation == android.content.res.Configuration
				.ORIENTATION_LANDSCAPE;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:5,代码来源:SearchView.cs

示例12: MenuBuilder

		public MenuBuilder(android.content.Context context)
		{
			mContext = context;
			mResources = context.getResources();
			mItems = new java.util.ArrayList<[email protected]>();
			mVisibleItems = new java.util.ArrayList<[email protected]>
				();
			mIsVisibleItemsStale = true;
			mActionItems = new java.util.ArrayList<[email protected]>(
				);
			mNonActionItems = new java.util.ArrayList<[email protected]
				>();
			mIsActionItemsStale = true;
			setShortcutsVisibleInner(true);
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:15,代码来源:MenuBuilder.cs

示例13: Scroller

		/// <summary>Create a Scroller with the specified interpolator.</summary>
		/// <remarks>
		/// Create a Scroller with the specified interpolator. If the interpolator is
		/// null, the default (viscous) interpolator will be used. Specify whether or
		/// not to support progressive "flywheel" behavior in flinging.
		/// </remarks>
		public Scroller(android.content.Context context, android.view.animation.Interpolator
			 interpolator, bool flywheel)
		{
			mFinished = true;
			mInterpolator = interpolator;
			mPpi = context.getResources().getDisplayMetrics().density * 160.0f;
			mDeceleration = computeDeceleration(android.view.ViewConfiguration.getScrollFriction
				());
			mFlywheel = flywheel;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:Scroller.cs

示例14: HolographicHelper

			internal HolographicHelper(android.content.Context context)
			{
				mDensity = context.getResources().getDisplayMetrics().density;
				mHolographicPaint.setFilterBitmap(true);
				mHolographicPaint.setMaskFilter(android.graphics.TableMaskFilter.CreateClipTable(
					0, 30));
				mErasePaint.setXfermode(new android.graphics.PorterDuffXfermode(android.graphics.PorterDuff.Mode
					.DST_OUT));
				mErasePaint.setFilterBitmap(true);
				mSmallBlurMaskFilter = new android.graphics.BlurMaskFilter(2 * mDensity, android.graphics.BlurMaskFilter.Blur
					.NORMAL);
				mLargeBlurMaskFilter = new android.graphics.BlurMaskFilter(4 * mDensity, android.graphics.BlurMaskFilter.Blur
					.NORMAL);
			}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:14,代码来源:StackView.cs

示例15: init

		private void init(android.content.Context context)
		{
			// Get both the scrollbar states drawables
			android.content.res.TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS
				);
			useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE));
			mTrackDrawable = ta.getDrawable(TRACK_DRAWABLE);
			mOverlayDrawableLeft = ta.getDrawable(PREVIEW_BACKGROUND_LEFT);
			mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT);
			mOverlayPosition = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING);
			mScrollCompleted = true;
			getSectionsFromIndexer();
			mOverlaySize = context.getResources().getDimensionPixelSize([email protected]
				.fastscroll_overlay_size);
			mOverlayPos = new android.graphics.RectF();
			mScrollFade = new android.widget.FastScroller.ScrollFade(this);
			mPaint = new android.graphics.Paint();
			mPaint.setAntiAlias(true);
			mPaint.setTextAlign(android.graphics.Paint.Align.CENTER);
			mPaint.setTextSize(mOverlaySize / 2);
			android.content.res.ColorStateList textColor = ta.getColorStateList(TEXT_COLOR);
			int textColorNormal = textColor.getDefaultColor();
			mPaint.setColor(textColorNormal);
			mPaint.setStyle(android.graphics.Paint.Style.FILL_AND_STROKE);
			// to show mOverlayDrawable properly
			if (mList.getWidth() > 0 && mList.getHeight() > 0)
			{
				onSizeChanged(mList.getWidth(), mList.getHeight(), 0, 0);
			}
			mState = STATE_NONE;
			refreshDrawableState();
			ta.recycle();
			mScaledTouchSlop = android.view.ViewConfiguration.get(context).getScaledTouchSlop
				();
			mMatchDragPosition = context.getApplicationInfo().targetSdkVersion >= android.os.Build
				.VERSION_CODES.HONEYCOMB;
			setScrollbarPosition(mList.getVerticalScrollbarPosition());
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:38,代码来源:FastScroller.cs


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