[英]No resource found that matches the given name (at 'src' with value '@android:drawable/logo.png
Firstly I am a beginner, learning to code by myself. 首先我是一个初学者,通过自己学习的代码。 I am using Visual Studio Xamarin to create an android app. 我正在使用Visual Studio Xamarin创建一个android应用程序。 I am trying to put assign an image called logo.png to an imageview. 我试图把所谓分配给logo.png的ImageView的图像。 I do not have a drawable file under the Resources file so I added a folder, named it 'drawable'. 我没有资源文件下,绘制文件,所以我加了一个文件夹,将其命名为“绘制”。 I then pasted the logo.png. 然后,我粘贴了logo.png。 The xml code for the imageview: imageview的xml代码:
<ImageView
android:src="@android:drawable/logo.png"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView1" />
I have not modified any java/ C# files. 我没有修改任何Java / C#文件。 Some of the unusual folders that I have under resources include mipmap-anydpi, mipmap-hdpi, mipmap-mdpi, mipmap-xhdpi, mipmap-xxhdpi, mipmap-xxxhdpi. 有的,我有资源下的不同寻常的文件夹包括纹理贴图,anydpi,纹理贴图,华电国际,纹理贴图,MDPI,纹理贴图,xhdpi,纹理贴图,xxhdpi,纹理贴图,xxxhdpi。 I tried having the logo.png on all these folders and tried to build with the same xml code but no improvements. 我想有所有这些文件夹的logo.png,并试图建立一个能与相同的XML代码,但没有改善。 (btw I nearly do not know any xml). (顺便说一句,我几乎不知道任何xml)。 and in this case it says activity_main.axml compared to how it is on the Android Studio which has the name activity_main.axml. 在这种情况下,它说的是activity_main.axml,与Android Studio上的名称为activity_main.axml的情况相比。 Does this have anything to do with the problem? 这和问题有关系吗? I am following this tutorial by the way: https://youtu.be/WBTZ7TSan_E 我下面这个教程的方式: https://youtu.be/WBTZ7TSan_E
If you puted the logo.png
: 如果您放了logo.png
:
on src/drawable/ use @drawable/logo.png
在src / drawable /上使用@drawable/logo.png
if on src/mipmap/ use @mipmap/logo.png
如果在src / mipmap /上使用@mipmap/logo.png
Why not @android:
? 为什么不@android:
This path point to android resources, are default files, belongs to Android SDK 此路径指向android资源,属于默认文件,属于Android SDK
Android OS has its own resources, like color variables, default dimensions, themes etc. Android OS具有自己的资源,例如颜色变量,默认尺寸,主题等。
If you use some internal drawable resources that exist in your phone, then you use: 如果您使用手机中存在的一些内部可绘制资源,则可以使用:
android:src="@android:drawable/..."
If you use the resources that you add in your app, in your folder drawable
, then use: 如果您使用在应用程序中添加的资源,则在您的文件夹drawable
,请使用:
android:src="@drawable/..."
It's important to remember that, as you will run into that quite often. 记住这一点很重要,因为您会经常遇到这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.