嗨,我是一名理工学院的学生。我对 xamarin 完全陌生,因此我将不胜感激。
所以我的问题是我最近关注了这个 tutorial关于如何在 xamarin android 上创建通知并在 MyBroadcastReceiver.cs
中遇到此问题。它表示在创建通知注释下 resource.drawable 不包含“SymActionEmail”的定义
。任何解决此问题的帮助将不胜感激。
最佳答案
我认为问题在于这个类所在的命名空间并且带有 .Android
后缀。这意味着 Android.Resource.Drawable
实际上并不引用 Xamarin Android 自己的 Resource.Drawable
类,而是引用您的项目特定的 Resource.Drawable
类(class)。为了克服这个问题,您需要重命名此类的命名空间,使其不以 .Android
结尾,或者为默认的 Android 命名空间添加 using
别名:
//add this to the using statements in this file
using Sys = Android;
...
//now use the following in your code
//to use Xamarin Android's built-in Resource.Drawable class
var notification = new Notification( Sys.Resource.Drawable.SymActionEmail, title );
关于c# - 关于 xamarin 的通知。 Android.Resource.Drawable.SymActionEmail 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38341625/