简体   繁体   English

找不到与给定名称匹配的资源(在'src'处,值为'@android:drawable / logo.png

[英]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.

相关问题 <Img src=“logo.png”>不在_Layout.cshtml中工作 - <Img src=“logo.png”> not working in _Layout.cshtml 在Xamarin.Android中找不到与给定名称匹配的资源(在&#39;headerLayout&#39;处) - No resource found that matches the given name (at 'headerLayout') in Xamarin.Android 如何修复Xamarin android c#中的“找不到与给定名称(在&#39;value&#39;处与值&#39;@ integer / google_play_services_version匹配)的资源” - How to fix“No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version)” in Xamarin android c# 找不到与给定名称Styles.xml匹配的资源 - No resource found that matches the given name Styles.xml 没有找到与给定名称匹配的资源,我在哪里做错了? - No resource found that matches the given name, where I do something wrong? 设置Xamarin.Forms-“找不到与给定名称匹配的资源...” - Setup Xamarin.Forms - “No resource found that matches the given name…” 找不到与给定名称匹配的资源 - No resource found that matches the given names 未找到与给定名称匹配的资源(值与值 @integer/google_play_services_version)”- Visual Studio 2015 更新 3 - No resource found that matches the given name (at value with value @integer/google_play_services_version)” - Visual Studio 2015 Update 3 Xamarin-检索项目的父项时出错:找不到与给定名称&#39;Theme.AppCompat.Light.DarkActionBar&#39;匹配的资源 - Xamarin - Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar' 找不到与common_signin_btn_icon_dark.xml中的给定名称匹配的资源 - No resource found that matches the given name in common_signin_btn_icon_dark.xml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM