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


C# Context.GetResources方法代码示例

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


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

示例1: GetIconId

        public static int GetIconId(string name, Context context)
        {
            if (icons.ContainsKey(name) == true)
            {
                return icons[name];
            }

            int id = context.GetResources().GetIdentifier(name, "drawable", context.GetPackageName());
            if (id == 0)
            {
                return 0;
            }

            icons.Add(name, id);

            return id;
        }
开发者ID:sschocke,项目名称:JGCompanion,代码行数:17,代码来源:Item.cs

示例2: LunarThread

			public LunarThread(LunarView view, ISurfaceHolder surfaceHolder, Context context, Handler handler)
			{
				// get handles to some important objects
			    this.view = view;
			    mSurfaceHolder = surfaceHolder;
				mHandler = handler;
				view.mContext = context;

				Resources res = context.Resources;
				// cache handles to our key sprites & other drawables
				mLanderImage = context.Resources.GetDrawable(R.Drawables.lander_plain);
				mFiringImage = context.Resources.GetDrawable(R.Drawables.lander_firing);
				mCrashedImage = context.GetResources().GetDrawable(R.Drawables.lander_crashed);

				// load background image as a Bitmap instead of a Drawable b/c
				// we don't need to transform it and it's faster to draw this way
				mBackgroundImage = BitmapFactory.DecodeResource(res, R.Drawables.earthrise);

				// Use the regular lander image as the model size for all sprites
				mLanderWidth = mLanderImage.IntrinsicWidth;
				mLanderHeight = mLanderImage.IntrinsicHeight;

				// Initialize paints for speedometer
				mLinePaint = new Paint();
				mLinePaint.SetAntiAlias(true);
				mLinePaint.SetARGB(255, 0, 255, 0);

				mLinePaintBad = new Paint();
				mLinePaintBad.SetAntiAlias(true);
				mLinePaintBad.SetARGB(255, 120, 180, 0);

				mScratchRect = new RectF(0, 0, 0, 0);

				mWinsInARow = 0;
				mDifficulty = DIFFICULTY_MEDIUM;

				// initial show-up of lander (not yet playing)
				mX = mLanderWidth;
				mY = mLanderHeight * 2;
				mFuel = PHYS_FUEL_INIT;
				mDX = 0;
				mDY = 0;
				mHeading = 0;
				mEngineFiring = true;
			}
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:45,代码来源:LunarView.cs

示例3: CreateSortContainers

    private List<View> CreateSortContainers(Context context, Text2Speech tts)
    {
      var result = new List<View>();

      var l = new HorizontalFlowLayout(context);
      l.SetBackgroundColor(context.GetResources().GetColor(R.Colors.light_blue));
      var p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1);
      //var p = new RelativeLayout.MarginLayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      p.SetMargins(7, 7, 7, 0);
      l.SetLayoutParams(p);
      var d = new MoveDropHandler { Id = "1" };
      d.OnMoveDropAccepted += sortObjects.ResultChecker.DropHandler;
      l.SetOnDragListener(d);
      result.Add(l);

      l = new HorizontalFlowLayout(context);
      l.SetBackgroundColor(context.GetResources().GetColor(R.Colors.light_blue));
      p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1);
      //p = new RelativeLayout.MarginLayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      p.SetMargins(7, 7, 7, 7);
      l.SetLayoutParams(p);
      d = new MoveDropHandler { Id = "2" };
      d.OnMoveDropAccepted += sortObjects.ResultChecker.DropHandler;
      l.SetOnDragListener(d);
      result.Add(l);
      return result;
    }
开发者ID:rfcclub,项目名称:dot42,代码行数:27,代码来源:SortTaskFactory.cs


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