最佳答案
处理不同硬件配置的首选方法似乎是define different Resources and let Android pick the relevant one for the hardware.文档说:
You can supply different resources for your application to use depending on the UI language or hardware configuration on the device. Note that although you can include different string,layout,and other resources,the SDK does not expose methods to let you specify which alternate resource set to load. Android detects the proper set for the hardware and location,and loads them as appropriate.
但是,没有什么能阻止您在应用程序中使用多个版本的属性文件并使用这些版本来确定硬件配置.例如,该文件的一个版本将包含dpad = true,另一个版本将包含dpad = false,Android将选择与硬件匹配的文件版本,然后您可以读取dpad属性.不可否认,这将是相当乏味的,但我无法在API中找到更简单的方法来执行此操作.