[TIMOB-18307] Android: backgroundImage doesn't load application resources
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | Ti.App.Android.R, drawable |
| Reporter | Fokke Zandbergen |
| Assignee | Unknown |
| Created | 2015-01-05T20:00:06.000+0000 |
| Updated | 2018-02-28T19:54:54.000+0000 |
Description
The attached test project shows that an image in the application resources *can* be used as an image, but not as a backgroundImage.
Problem
The first View will not display the 9-patch image located inplatform/android/res; this is the actual problem. The second ImageView *will* display the image in platform/android/res, but since it 9-patch is only supported for backgrounds it is stretched. The third View displays the same 9-patch image in Resources/images as expected.
Use case
What I wan to do is re-use the launch image as a background later in the app. Of course I can keep additional copies for all densities in but this increases the size of the app largely.Code from the attached project
var win = Ti.UI.createWindow();
win.add(Ti.UI.createView({
top: 0,
left: 0,
width: '33%',
height: Ti.UI.FILL,
backgroundColor: 'red',
backgroundImage: Ti.App.Android.R.drawable.drawablenine
}));
win.add(Ti.UI.createImageView({
top: 0,
left: '33%',
width: '34%',
height: Ti.UI.FILL,
backgroundColor: 'green',
image: Ti.App.Android.R.drawable.drawablenine
}));
win.add(Ti.UI.createView({
top: 0,
right: 0,
width: '33%',
height: Ti.UI.FILL,
backgroundColor: 'blue',
backgroundImage: '/images/resourcesnine.png'
}));
win.open();
Attachments
| File | Date | Size |
|---|---|---|
| android_20150105-212740.png | 2015-01-05T20:27:54.000+0000 | 104798 |
| bg.zip | 2015-01-05T20:28:15.000+0000 | 45811 |
No comments