简体   繁体   English

适用于Android的Titanium / Appcelerator:找不到多个密度图像

[英]Titanium/Appcelerator for Android: Multiple density images not found

I followed the guide here: http://developer.appcelerator.com/guides/en/app_structure.html 我在这里遵循了指南: http : //developer.appcelerator.com/guides/en/app_structure.html

to use high & medium density images for android. 为Android使用高密度和中等密度的图像。

My file structure is: 我的文件结构是:

/Resources
/Resources/android
/Resources/android/images
/Resources/android/images/high/ic_menu_add.png
/Resources/android/images/medium/ic_menu_add.png
/Resources/android/images/default.png
/Resources/user
/Resources/user/super.js
/Resources/app.js

the default.png loads as expected. default.png按预期加载。

I added 6 buttons to my menu in super.js (to try and debug this): 我在super.js的菜单中添加了6个按钮(以尝试对其进行调试):

var activity = Ti.Android.currentActivity;
activity.onCreateOptionsMenu = function(e) {
  var menu = e.menu;
  var menuItem1 = menu.add({ title: "1" });
  menuItem1.setIcon("/images/ic_menu_add.png");
  menuItem1.addEventListener("click", function(e) {
  });
  var menuItem2 = menu.add({ title: "2" });
  menuItem2.setIcon("../images/ic_menu_add.png");
  menuItem2.addEventListener("click", function(e) {
  });
  var menuItem3 = menu.add({ title: "3" });
  menuItem3.setIcon("../ic_menu_add.png");
  menuItem3.addEventListener("click", function(e) {
  });
  var menuItem4 = menu.add({ title: "4" });
  menuItem4.setIcon("/images/ic_menu_add.png");
  menuItem4.addEventListener("click", function(e) {
  });
  var menuItem5 = menu.add({ title: "5" });
  menuItem5.setIcon("/ic_menu_add.png");
  menuItem5.addEventListener("click", function(e) {
  });
  var menuItem6 = menu.add({ title: "6" });
  menuItem6.setIcon("ic_menu_add.png");
  menuItem6.addEventListener("click", function(e) {
  });
}

When I press the menu button: 当我按下菜单按钮时:

12-15 14:23:59.091: INFO/TiFileHlpr(537): (main) [4617,7631] /images/ic_menu_add.png not found.
12-15 14:23:59.101: INFO/TiFileHlpr(537): (main) [4,7635] ../images/ic_menu_add.png not found.
12-15 14:23:59.121: INFO/TiFileHlpr(537): (main) [25,7660] ../ic_menu_add.png not found.
12-15 14:23:59.121: INFO/TiFileHlpr(537): (main) [3,7663] /images/ic_menu_add.png not found.
12-15 14:23:59.131: INFO/TiFileHlpr(537): (main) [5,7668] /ic_menu_add.png not found.
12-15 14:23:59.140: INFO/TiFileHlpr(537): (main) [5,7673] ic_menu_add.png not found.

The official guide says to use just 'ic_menu_add.png' which is case 6 and doesn't work. 官方指南说只使用“ ic_menu_add.png”,这是情况6,不起作用。

The build directory looks like this: 构建目录如下所示:

/build/android/res/drawable-hdpi/ic_menu_add_ad7ef1aa68.png
/build/android/res/drawable-mdpi/ic_menu_add_ad7ef1aa68.png

My custom AndroidManifest.xml has this section in it: 我的自定义AndroidManifest.xml中包含以下部分:

<supports-screens 
   android:largeScreens="true"
   android:anyDensity="true"
   android:normalScreens="true"  android:smallScreens="true"/>

Anyone know the proper way to get multiple density images to work? 任何人都知道使多个密度图像工作的正确方法吗? [I'm using mobile sdk 1.5.x] [我正在使用移动SDK 1.5.x]

This is a known and logged issue. 这是一个已知且已记录的问题。 It is scheduled to be fixed in the 1.6 计划在1.6中修复

You can check out the log from their bug tracking system: 您可以从他们的错误跟踪系统中查看日志:

Medium Density Images Bug Logged - Appcelerator 记录中密度图像的错误-Appcelerator

So, no immediate relief for you but it's coming. 因此,您不会立即得到缓解,但是它即将来临。 This happens to be on occasion, I'm currently waiting for the UIscreen for iOS so I can support external displays / VGA dongle. 碰巧的是,我目前正在等待iOS的UIscreen,因此我可以支持外部显示器/ VGA加密狗。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM