开发者

How to tell Application's AndroidManifest.xml take @string from a specific package

开发者 https://www.devze.com 2023-03-30 04:22 出处:网络
In my application\'s AndroidManifest.xml I am trying to tell it to use a string from a/res/values in a particular package instead of the first one one found in one of thelibraries (the string my_label

In my application's AndroidManifest.xml I am trying to tell it to use a string from a /res/values in a particular package instead of the first one one found in one of the libraries (the string my_label could be defined in more than one libraries) :

   <application android:icon="@drawable/icon" 
                android:label="com.example.projname.appmodule:@string/my_label">

The above notation/syntax doesn't work, however. It only accepts the following form which doesn't allow pin-pointing a specific resource file:

   <application android:icon="@drawable/icon" 
                android:label="@string/my_label">

Is it possible at all to tell Application's AndroidManifest.xml take a @string value from a specific /res/values?

EDIT: The interesting thing is, the build environment doesn't complain at all about the "com.example.projname.appmodule:@string/my_label" syntax. But when the application runs, it displays com.example.projname.appmodule:@string/my_label instead of the string value.

As @Nikola Despotoski suggested below, a workaround could be setting this programmatically in the application, but since the build environment doesn't complain about this syntax, I am still wondering whether this a bug in the 开发者_运维技巧build env or something that I have been missing.

My workaround, for now, is to make sure that my_label is unique, e.g. my_3F2504E0-4F89-11D3-9A0C-0305E82C3301_label so it can't appear in any other package.

0

精彩评论

暂无评论...
验证码 换一张
取 消