特定产品的 Android 资源

标签 android android-resources android-x86

我从“设置”应用程序中获得此代码...

<string name="about_settings" product="tablet">About tablet</string>
<string name="about_settings" product="default">About phone</string>

那么我的问题是:

  1. 系统在运行时从哪里加载正确的字符串资源?
  2. 要添加新产品我必须做什么?例如

    <string name="about_settings" product="laptop">About laptop</string>
    

最佳答案

  1. from where at runtime the system load the correct string resource ?

系统不会在运行时加载它。根据为特定目标构建定义的 PRODUCT_CHARACTERISTICS 预加载正确的字符串资源。所以你不能在从 Eclipse 构建时使用它。这仅用于构建平台上预加载的应用。

2 . What must I do to add a new product? e.g.

您需要在 device.mk 文件中添加到 PRODUCT_CHARACTERISTICS

关于特定产品的 Android 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16995503/

相关文章:

android - 自定义 View RatingBar 调用了 setOnTouchListener 但没有覆盖 performClick

android - getQuantityString 返回值为 0 的错误字符串

android - 何时转义字符串资源中的实体?

android - 更新 SDK 后,Pixel 启动器一直停止

android - 为 ARM 编写的原生 android 代码如何在 x86 上运行?

android - 如何从任何其他应用程序打开内置的谷歌日历?

Android:如何在 UI 中更新 Realm 列表

java - Android 动态行创建中的 IllegalStateException

android - 无法解析模块中的符号 'R'

virtualBox上的Android在空闲后卡住了