Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Low
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 7.5.0
-
Component/s: Android
-
Sprint:2018 Sprint 20 SDK
Description
Summary:
The image and backgroundImage properties require a leading slash '/' on Android when loading an image file from the "Resources" directory or else it will fail to load. iOS and Windows do not require the leading slash, although they will accept it too. Android should be changed to be consistent with iOS and Windows.
For example, if you have an image file in the following location in a Classic app...
./Resources/assets/images/Test.png
On Android, you have to load the above image file like this...
var imageView = Ti.UI.createImageView({ |
image: "/images/Test.png", |
});
|
On iOS and Windows, you can load the image with or without the leading slash...
var imageView = Ti.UI.createImageView({ |
image: "images/Test.png", // This works. |
// image: "/images/Test.png", // This also works.
|
});
|
Changing Android to support both would make it less confusing for developers who work on the iOS side first.
Note:
This is not an issue when loading files via Ti.Filesystem.getFile(). Accessing files via a relative path works in this case. This is an issue with accessing files via relative paths (ie: no leading slash).
Original Bug Report:
As can be seen here (http://developer.appcelerator.com/question/148590/alloy-android-not-getting-images) to load images on android using alloy we need to use a forward slash (/) before the image name, I know it's not a big work for us, but we don't need it using default appcelerator.
Attachments
Issue Links
- relates to
-
TIMOB-23809 iOS: Relative images paths are not relative to Resources dir, not current JS file
-
- Open
-
-
TIMOB-16742 Android: Inconsistency in the handling of leading '/' of ImageView
-
- Closed
-