Xamarin Resource.designer.cs 不为新添加的文件生成引用 [英] Xamarin Resource.designer.cs not generating reference for newly add file

查看:33
本文介绍了Xamarin Resource.designer.cs 不为新添加的文件生成引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 ImageView 的 src 属性设置为 @drawable/citybase 时,我将一个名为 citybase.png 的文件添加到我的 drawable 文件夹中,但图像没有显示在设计视图中.检查 Resource.designer.cs 类,我意识到我添加到 drawable 文件夹中的任何文件都没有生成任何引用(当然默认图标除外).

I am adding a file called citybase.png to my drawable folder when I set the src property of my ImageView to @drawable/citybase the image is not showing up in the design view. Inspecting the Resource.designer.cs class I realize that no reference is being generated for any files I add to the drawable folder(except for the default Icon of course).

    public partial class Drawable
    {

        // aapt resource value: 0x7f020000
        public const int Icon = 2130837504;

        static Drawable()
        {
            global::Android.Runtime.ResourceIdManager.UpdateIdValues();
        }

        private Drawable()
        {
        }
    }

我尝试重建和清理项目,但这不起作用.我该如何解决这个问题?(Xamarin Studio 4.2.3)

I tried rebuilding and cleaning the project but that does not work. How can I fix this problem? (Xamarin Studio 4.2.3)

推荐答案

drawable 文件夹的名称应该是小写的(在visual studio中,它总是在创建项目时以名称'Drawable'创建),同时避免使用诸如'@之类的符号'、'#' 等.

The drawable folder name should be in lowercase (in visual studio it always create with name 'Drawable' when creating project), also avoid using such symbols like '@', '#' and so on.

这篇关于Xamarin Resource.designer.cs 不为新添加的文件生成引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆