特定产品的Android资源

Lui*_*iel 11 android android-x86 android-resources

我从设置应用程序中获取此代码...

<string name="about_settings" product="tablet">About tablet</string>
<string name="about_settings" product="default">About phone</string>
Run Code Online (Sandbox Code Playgroud)

然后我的问题是:

  1. 从运行时的系统加载正确的字符串资源?
  2. 我该怎么做才能添加新产品?例如

    <string name="about_settings" product="laptop">About laptop</string>
    
    Run Code Online (Sandbox Code Playgroud)

nan*_*esh 12

  1. 从运行时的系统加载正确的字符串资源?

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

2.我该怎么做才能添加新产品?例如

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