How to reference a string from another package in a library using XML in Android?

后端 未结 5 1214
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 04:09

The Android documentation tells me that I can access a string from another package by using the \"package name\", whatever that means:

@[         


        
5条回答
  •  旧时难觅i
    2020-12-16 04:53

    In short: package name prefix is for shared libraries, not for your apk.

    The documentation reads:

    To reference a system resource, you would need to include the package name

    This corresponds for external shared libraries (and their resources), your application is linked against (e.g. maps). They have their own R class, not merged with that of your application.

    These are all standard android packages and shared libraries you mentioned in section of android manifest.

    As Nikolay pointed out, all app resources are merged, that is why the majority library projects use prefixes like abs__ for their resource names.

    See Library projects doc for additional info.

提交回复
热议问题