Android 要一个可拖动的单机器人?

Android 要一个可拖动的单机器人?,android,xamarin.android,Android,Xamarin.android,我正在使用此代码获取一个drawable,并在SetCompoundDrawableSwithinInstincBounds调用中使用: Drawable d = Resources.System.GetDrawable(Resource.Drawable.navigable_icon); textView.SetCompoundDrawablesWithIntrinsicBounds(null,null,d,null); 问题是调用GetDrawable方法时,我总是会得到一个异常,说明:

我正在使用此代码获取一个drawable,并在
SetCompoundDrawableSwithinInstincBounds
调用中使用:

Drawable d = Resources.System.GetDrawable(Resource.Drawable.navigable_icon);
textView.SetCompoundDrawablesWithIntrinsicBounds(null,null,d,null);
问题是调用
GetDrawable
方法时,我总是会得到一个异常,说明:

Android.Content.Res.Resources+NotFoundException:资源ID 0x7f020009


drawable
与我在
drawable
目录中xml中使用的任何其他文件一样存在。有人能猜出发生了什么吗?

你从哪里打电话来的

据我所知,Resources类没有系统属性,intellisense告诉我,这是获取可绘制文件的方法:

var drawable = Resources.GetDrawable(Resource.Drawable.navigable_icon);
textView.SetCompoundDrawablesWithInstrinsicBounds(null,null,drawable,null);

是的,这是我在stackoverflow的所有帖子中看到的。但对我来说,Resources.GetDrawable()不存在。你介意告诉我你导入了什么吗?这些是我的导入:使用系统;使用Android.App;使用Android.Graphics;使用Android.Views;使用Android.Widget;使用Android.OS;资源是一个可以通过活动上下文访问的道具。在我的例子中,我可以在Resources->public static Resources System{get;}中看到这个方法。我有上一个monodroid版本:/。系统摘要:返回一个全局共享资源对象,该对象仅提供对系统资源(无应用程序资源)的访问,并且未针对当前屏幕进行配置(不能使用维度单位,不会根据方向等进行更改)。因此,回到我的问题,您是否正在从活动调用Resources.GetDrawable?