简体   繁体   English

androidmanifest.xml文件解析属性条目

[英]androidmanifest.xml file resolves attribute entries

I am new to Android and started with hello world app. 我是Android的新手,并开始使用hello world app。

I was going through AndroidManifest.xml 我正在浏览AndroidManifest.xml

   <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
    </application>

I am trying to figure out where is this ic_launcher file located or has some variable mapped. 我试图找出这个ic_launcher文件的位置或映射了一些变量。

I have folder as 我有文件夹作为

res/drawable-hdpi
res/drawable-ldpi

I can see all folder has ic_launcher.png file, now my question is from which folder it will pick this image. 我可以看到所有文件夹都有ic_launcher.png文件,现在我的问题是从哪个文件夹中选择这个图像。 Also, I saw there is one entry in R.java file for this name as, 另外,我看到R.java文件中有一个条目用于此名称,

public static final class drawable {
    public static final int ic_launcher=0x7f020000;
}

What is the relation between entry in R.java and AndroidManifest.xml. R.java和AndroidManifest.xml中的条目之间有什么关系。

Also, second line is android:label="@string/app_name" I can see in strings.xml file, there is one entry for these, 另外,第二行是android:label="@string/app_name"我可以在strings.xml文件中看到,这些有一个条目,

  <string name="app_name">MyMapLocation</string>

Now, where it is written in AndroidManifest.xml file(or any other place) that go and check for app_name variable entry in strings.xml file? 现在,它在AndroidManifest.xml文件(或任何其他地方)中写入并检查strings.xml文件中的app_name变量条目?

I am sorry to ask this basic question but want to clear doubts. 我很遗憾地问这个基本问题,但想清楚疑惑。

Question is, from which folder it will pick this(ic_launcher.img) image. 问题是,它将从哪个文件夹中选择此图像(ic_launcher.img)。

It will depend on the screen size of the device, if screen size comes in LDPI icon.img of drawable-ldpi would be picked up by system at run time. 它将取决于设备的屏幕大小,如果屏幕大小是LDPI icon.drawg的drawable-ldpi将在运行时被系统拾取。

Now, where it is written in AndroidManifest.xml file(or any other place) that go and check for app_name variable entry in strings.xml file? 现在,它在AndroidManifest.xml文件(或任何其他地方)中写入并检查strings.xml文件中的app_name变量条目?

@string/app_name >> @string tells xml files that go to string.xml and search for app_name there. @ string / app_name >> @string告诉xml文件转到string.xml并在那里搜索app_name。

Edit:- here is what docs says about accessing resouces via Blad0rz 编辑: - 以下是关于通过Blad0rz 访问资源的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM